May 2010
Intermediate to advanced
1272 pages
61h 18m
English
Adding entities against an entity data model requires you to pass the instance of the entity to the Add method exposed by the entity set. For example, in our demonstration scenario we have a Products entity set exposing an Add method. The following code shows how you can programmatically create a new product and add it to the object model:

First, the code checks if the product already exists based on the specified condition. This is accomplished invoking the Single extension method, whose support is new in .NET Framework 4.0. It is something that you already saw in LINQ to SQL and not discussed thoroughly here. Notice how you simply ...
Read now
Unlock full access