Home  /  Questions  /  Question

61   95.6
Jul 10, 2012

When shall I use Entity Framework?

In the Design Pattern Framework 4.0 you use Entity Framework for data access.
Why did you choose to use Entity Framework in your product?

Could you please let me know when we should use Entity Framework vs any other data access technology?
What are common alternatives to Entity Framework?


820   99.9
Jul 11, 2012
Entity Framework is used by default in the Design Pattern Framework 4.0, but in fact, it ncludes 3 data access technologies:

    1) Entity Framework (EF)
    2) LINQ-to-SQL
    3) ADO.NET 

EF can easily be swapped out by LINQ to SQL or ADO.NET in the Framework..  These are popular options, but another popular alternative, not included in the Design Pattern Framework, is NHibernate.

Microsoft's position is that EF is the way to go.  LINQ-to-SQL is pretty much an unsupported product by now.  If performance is critical to your app, you should consider ADO.NET as this allows you to fine-tune your SQL exactly to your needs.  The way I see it is that EF is always a bit of a black box with respect to the SQL that is generated under the hood.

Hope this helps.

65   95.7
Aug 04, 2012
Hi, Ba.

When the Brass gives you and your team enough time to thoroughly create a decent model, then start thinking EF. OR/M has always been a pipe dream for those that have to "just get it done". Microsoft is the latest player in a game that's seen other players come and go.

If you've been given that luxury then use it in conjuction with the SQL server admin, or whomever writes the SQL database, because you're going to need to map. If you get a decent synergy going then coding the problem domain is much more intuitive, which really is only effective in a team environment.

Just my opinion.