开发者

I'm a Linq-to-SQL rookie, but I'm looking into Entity Framework. Is it much harder to use?

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 fr开发者_高级运维om area "Boston". What about in EF?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜