StronglyTyped
StronglyTyped

Reputation: 2134

Need Advice: Switching from Linq to SQL to Entity Framework

I know the high-level differences between linq to sql and entity framework, however, I am hoping for advice from someone else who has already made the switch themselves, or has sufficient experience with both. Coming from a strong linq to sql background, as far as implementation and low-level details, are there any important things I need to know as I start coding my new data access layer project with entity framework?

I already created my edmx file (I chose the database-first approach), and everything just seems suspiciously identical to linq to sql so far. What would help me is a short list of items, like, in linq to sql, you do [this] [this way], but in entity framework, you'll want to do it [this way].

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

Upvotes: 4

Views: 489

Answers (2)

Constant Learner
Constant Learner

Reputation: 525

NH is far better... but again as EF is microsoft baby, it will grow as time goe

Upvotes: 0

Be.St.
Be.St.

Reputation: 4181

In new project between L2S and EF I suggest EF (consider Entity Framework version 4.0 or superior, DON'T use early EF releases).

While Linq to SQL is a class to table mapping EF 4 is a complete ORM (Object Relational Mapping) tool with different mapping scenarios.

With EF you have a lot of flexibility:

  • Database First approach
  • Model First approach
  • Code First approach

and a strong integration with LINQ Provider.

Unit testing with Linq2SQL is a nightmare. With EF you have POCO (Plain Old CLR Object) classes out of the box. In L2S the entity class is tight coupled to the L2S namespace.

EF can help you also in Domain Driven Design scenarios.

Microsoft consider now EF the first database access method and it's the base for other services like RIA services or MVC database scaffolding.

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

Upvotes: 1

Related Questions