Add / update list of objects using entity structure

I am returning a List (native class) from Silverlight to the service, there are old objects with updated values ​​and completely new entities in this list, how can I save this back to the database using the entity structure?

Using cEnts.CardItems.AddObject gives me obviously duplicates.

+3
source share
2 answers

You want to use Attach () instead of AddObject ().

Attach will take your disconnect object and inform the container of this for updating. New objects will be added without PrimaryKey.

+3
source

Source: https://habr.com/ru/post/1726202/


All Articles