There are lof of difference between Linq to Sql and Entity framework like Linq to SQL is one to one mapping and EF is many to many mapping and many other which can be found at Entity Framework vs LINQ to SQL
But here I am asking with EF and Linq to Sql, do we create Entities first and then generate tables or the other way and what are positives and negatives of both the approaches. In EF could there be any business entities which are inherited form multiple tables and does not represent any thing in the DB. Is Linq to Entities different from EF?
P开发者_如何学Pythonlease let me know if question is not clear or wrongly asked. Thanks in advance guys.
For "production" releases, both EF & L2S require that a data model (read: Database schema) be in place before any classes can be generated. The ability to create your classes first and then generate the DB from that is available in the form of the EF4 CTP that ScottGu blogged about recently.
As far as a single Entity reflecting multiple tables: I believe that is currently a one-to-one relationship: 1 table = 1 Entity.
I believe with either EF 4, or an add-on, you can create your model first and have it generate your DB schema. Prior to EF 4, and with Linq-to-SQL you need to start with the DB and map the models.
in linq to SQL you first make a database, then import it, build the app and your objects will be made.
i started to fool around with EF at first learning MVC, then at the point of starting to work with the code i used linq to SQL, and, well, it's both linq, there is no real difference in the linq queries that i can tell.
精彩评论