Monday, November 15, 2010

Entity frame work vs. Enterprise Library


                           In .NET Framework 4.0 having huge improvements in entity-framework. I have specified some of them  below .


Entity Framework 4.0

Enterprise Library 5.0


compiled cached queries :It is simply a query for which you tell the framework to keep the parsed tree in memory so it doesn't need to be regenerated the next time you run it. So the next run, you will save the time it takes to parse the tree.

Explanation :The first time you run this query, the framework will generate the expression tree and keep it in memory. So the next time it gets executed, you will save on that costly step.

NO Support .Use Store Producers instead of hoc queries to improve the performance .


Model-First: Create your Entity Data Model and from that model generate DDL to create the database.

Model –Last :Create your database first and Implement your Entities .


Developing vise verse possible (Entity to Tables ) and (Tables to Entity)

No Support


MVC with the Entity Data Source Control and the Entity Framework to quickly create data driven web.

Need to implement Business Entities manually (takes more time ).


LINQ Support

LINQ Support


Multiple related tables to a single entity and reduce code complexity.

No Support


Simplify Application Maintenance:By using entities in place of traditional data access code, changes to the underlying database schema do not always require changes to the application code.

Extend your applications to use more powerful editions of SQL Server or replace the database that


Automatically creates Complex types -Functions where as Enterprise library we have to create custom type

Need to implement manually


No need to write any code for Business entities

DAL framework, its very hard to come back and change later,no matter your architecture, because you'll have to redo a lot of code, be it well isolated or not


Returns Strong types

Returns Dataset/Data table which make heavy (needs to covert to strong types )


Re commanded development strategy Either simply need to be put away in a dedicated layer so that swapping them out and replacing them becomes way easier and makes your application more maintainable. This is simply applying good architectural designs.


Little bit slower when compare to Enterprise Library (store procedure mapping by default hock queries )(we can tune to improve the performance [Support only 4.0)


Custom Code-Gen Leverage T4, Text Template Transformation Toolkit, an easy, flexible and powerful Code Generation tool that is fully integrated into the Visual Studio experience to customize the generation of POCO or Entity Classes.

Required Third party tools to generate business entities


Easily maintainable and changeable

Takes more time for changes


Model Driven Development Separate the logical storage model of data from the way you model data within the application. The Entity Framework provides a mapping between the application data model and the relational database model .

No support for MDD


Advantages:Support POCO templates (plain old CLR objects)


you can get more information on Entity Frame work  in following links  :

Recommenced Entity frame work Books:

1.Entity Framework 4.0 Recipes: A Problem-Solution Approach- By Larry Tenny, Zeeshan Hirani

2.Pro Entity Framework 4.0- By Jim Wightman, Scott Klein