Wednesday, July 25, 2012

Advantages and Disadvantages of Entity Framework in .NET

The EF is essentially an O/R mapping tool. It takes care of object persistence for you. In other words, it acts as your data layer. writing applications using entity framework saves lot of development time and its good..if we are developing enterprise applications, we need to think about performance..all in all its good for small applications..

  1. Advantages : One common syntax ( LINQ / Yoda ) for all object queries whether it is database or not , Pretty fast if used as intended , easy to implement SoC , less coding required to accomplish complex tasks
    Disadvantages : you have to think in a non traditional way of handling data , not available for every database
  2. Disadvantage: If there is any schema change in database FE won’t work!!! You have to update the schema in solution as well!!!
    Advantage: Its fast and straight forward using LINQ/FE objects For Add/Modify/Delete/Update.
  3. Advantages:-Easy to map business objects (with drag & drop tables on environment).
    -It keeps a good performance when you work with a small / middle domain model.
    Disadvantages:-It's limited when you work with a huge domain model.
    -Scalability.

After getting dig into this topic, One question comes in our mind that is “Entity Framework vs. LINQ to SQL”

  • LINQ to SQL is the quick-and-easy way to do it. This means you will get going quicker, and deliver quicker if you are working on something smaller.
  • Entity Framework is the all-out, no-holds-barred way to do it. This means you will take more time up-front, develop slower, and have more flexibility if you are working on something larger.
  • LINQ to SQL only supports 1 to 1 mapping of database tables, views, sprocs and functions available in Microsoft SQL Server. It's a great API to use for quick data access construction to relatively well designed SQL Server databases. LINQ2SQL was first released with C# 3.0 and .Net Framework 3.5.
  • LINQ to Entities (ADO.Net Entity Framework) is an ORM (Object Relational Mapper) API which allows for a broad definition of object domain models and their relationships to many different ADO.Net data providers. As such, you can mix and match a number of different database vendors, application servers or protocols to design an aggregated mash-up of objects which are constructed from a variety of tables, sources, services, etc. ADO.Net Framework was released with the .Net Framework 3.5 SP1.
  • Linq-To-Sql - use this framework if you plan on editing a one-to-one relationship of your data in your presentation layer. Meaning you don't plan on combining data from more than one table in any one view or page.
  • Entity Framework - use this framework if you plan on combining data from more than one table in your view or page. To make this clearer, the above terms are specific to data that will be manipulated in your view or page, not just displayed. This is important to understand.

1 comment: