Reading this MSDN article titled "Working with ObjectSet (Entity Framework)" It shows two examples on how to add a Product.. one for 3.5 and another for 4.0.
http://msdn.microsoft.com/en-us/library/ee473442.aspx
Through my lack of knowledge I am possibly completely missing something here, but i never added a Product like this:
//In .NET Framework 3.5 SP1, use the following code: (ObjectQuery)
using (AdventureWorksEntities context = new AdventureWorksEntities())
{
// Add the new object to the context.
context.AddObject("Products", newProduct);
}
//New in .NET Framework 4, use the following code: (ObjectSet)
using (AdventureWorksEntities context = new AdventureWorksEntities())
{
// Add the new object to the context.
context.Products.AddObject(newProduct);
}
I would not have done it either way and just used:
// (My familiar way)
using (AdventureWorksEntities context = new AdventureWorksEntities())
{
// Add the new object to the context.
context.AddToProducts(newProduct);
}
What's the difference between these three ways?
Is "My way" just another way of using an ObjectQuery?
Thanks, Kohan