What's all the hype over objectsets?

Posted by Kohan on Stack Overflow See other posts from Stack Overflow or by Kohan
Published on 2010-05-11T10:20:45Z Indexed on 2010/05/11 10:34 UTC
Read the original article Hit count: 341

Filed under:
|

I am an intermediate user of EF in .net 3.5 and have recently moved to working with .net 4.

One think i keep coming across when reading various tutorials is the use of ObjectSets instead of ObjectQuerys and that they are a great new feature.

What is so great about them?

Reading this MSDN article titled "Working with ObjectSet (Entity Framework)" It shows two examples for on how to add a Product.. one for 3.5 and another for 4.0.

http://msdn.microsoft.com/en-us/library/ee473442.aspx

Though my lack of knowledge I am possibly bringing up a seperate point here, but i never added a Product like this:

//In .NET Framework 3.5 SP1, use the following code: 
using (AdventureWorksEntities context = new AdventureWorksEntities())
{
   // Add the new object to the context.
   context.AddObject("Products", newProduct);
}

I would have just used context.AddToProducts(newProduct);

Please enlighten me.

Kind regards, Kohan

© Stack Overflow or respective owner

Related posts about entity-framework

Related posts about .net-4.0