Need advice: switching from Linq to SQL on Entity Framework

I know the high level differences between linq and sql and the entity infrastructure, however I hope to get advice from someone who has already made the switch itself, or has enough experience for both. Based on the strong linq to sql background, how low-level details are implemented, are there any important things that I need to know when I start coding my new data access level project with an entity framework?

I already created my edmx file (I chose the first approach to the database), and all this seems suspiciously identical to linq for sql so far. What helps me is a short list of elements, for example, in linq to sql, you [this] [this path], but in the entity infrastructure you will want to do it [this way].

Sorry if this is a strange question, but any attempted answers would be greatly appreciated. Thanks!

+4
source share
2 answers

In a new project between L2S and EF, I propose EF (consider Entity Framework version 4.0 or higher, DO NOT use earlier releases of EF).

While Linq to SQL is a mapping of a class to a table, EF 4 is a complete Object Relational Mapping (ORM) tool with various mapping scripts.

With EF, you have a lot of flexibility:

  • Database First Approach
  • Model First Approach
  • Code First Approach

and strong LINQ provider integration.

Group testing with Linq2SQL is a nightmare. With EF, you have the POCO (Plain Old CLR Object) classes out of the box. In L2S, an entity class is closely related to the L2S namespace.

EF can also help you with domain-driven scripting scenarios.

Microsoft is now considering EF's first database access method, and it is the base for other services, such as RIA services or MVC database databases.

LinqToSql is now the first database access methodology only in Windows Phone scripts.

+1
source

NH is much better ... but again, since EF is a microsoft baby, it will grow over time

0
source

Source: https://habr.com/ru/post/1387573/


All Articles