Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Writing PK Values for custom objects #5289


User avatar
0
sedulen created

can we insert PK values into custom objects? Our ASPNZ system will be populated with records from another system and we would like to write the PK values from the external system.

Thanks


2 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    Just like the documents says: [https://www.aspnetboilerplate.com/Pages/Documents/Entities#iextendableobject-interface])

    IExtendableObject defines the ExtensionData string property which is used to store JSON formatted name value objects.

    So it can store any object that can be serialized into json

    While this technique can be very useful in some cases (when you need to provide the ability to dynamically add extra data to an entity), you should normally use regular properties. Such dynamic usage is not type safe and explicit.

  • User Avatar
    0
    travelsoft created

    If your custom object has a pk that is a identity column in your sql server then you first must turn of identity before inserting.

    Do note my advice is more regarding importing data in to your database one time only. If you want to do this on a live database or in production mode it's not really a good idea