views:

39

answers:

1

For example, one of the joys I've learned from L2S is that when creating the .dbml file, it automagically lets me create object of the Table with fields of the table columns. I do absolutely nothing and I can query things using a very natural approach using Linq and lambda expressions.

I've also been told that L2S doesn't work with many to many relationships. Is this true? For example, I have tables: Documents and Areas. A document can belong in many areas, and an area can have many documents.

How could I use L2S to say, return a collection of documents from area "Boston". What about in EF?

+2  A: 

Entity Framework is a little harder to use than L2S, but not much... The added complexity is because you can model your data in a much more flexible way, but if your model is simple and not heavily customized, it is just as easy as L2S.

I do absolutely nothing and I can query things using a very natural approach using Linq and lambda expressions.

You can do the same with Entity Framework, there is also a designer that generates all the necessary code

I've also been told that L2S doesn't work with many to many relationships. Is this true? For example, I have tables: Documents and Areas. A document can belong in many areas, and an area can have many documents.

You can do it with L2S, but I think you will need to have an entity to represent the association. In Entity Framework, you can get rid of that "dummy" entity and define a real many-to-many relationship

Thomas Levesque
+1: is datacontext/session handling more difficult in EF? Could you talk about the differences in context handling, "attaching" entities, cascading saves etc...?
andy
@andy, sorry, I haven't used L2S enough to tell you precisely what the differences are...
Thomas Levesque
See [MSDN (Working with Objects)](http://msdn.microsoft.com/en-us/library/bb738470.aspx); just ignore all the POCO stuff; it doesn't apply in your situation.
Stephen Cleary