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 .

Sl.No

Entity Framework 4.0

Enterprise Library 5.0

1.

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 .

2.

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 .

3.

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

No Support

4.

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 ).

5.

LINQ Support

LINQ Support

6.

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

No Support

7.

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

 
8.

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

Need to implement manually

9.

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

10.

Returns Strong types

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

11.

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.

 
12.

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)

 
13.

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

14.

Easily maintainable and changeable

Takes more time for changes

15.

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

16.

Advantages:Support POCO templates (plain old CLR objects)

 

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

http://msdn.microsoft.com/en-us/magazine/cc188702.aspx

http://msdn.microsoft.com/te-in/magazine/cc163766%28en-us%29.aspx

http://channel9.msdn.com/Blogs/wriju/Using-Stored-Procedure-in-ADONET-Entity-Framework-40

http://msdn.microsoft.com/en-us/data/ff191186.aspx

http://msdn.microsoft.com/en-us/data/ef.aspx

http://channel9.msdn.com/Blogs/matthijs/C-40-and-beyond-by-Anders-Hejlsberg

http://msdn.microsoft.com/en-us/library/bb896279.aspx

http://jalpesh.blogspot.com/2010/08/entity-framework-40-bind-stored.html

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

Internationalization and best practices to go for globalization vs. localization.


                             

                             Now a days every application clients wants to implement internationalization .Many people don't know what are the better practices for implementing globalization vs.localization .I have specified some of them apply according to your project requirement .you can find the basic tutorial in msdn here .

1.label's are heavy :                              Using label in every magic string will become very heavy .Because for every label ASP.NET engine needs to generate span tag.

Recommended  way : Literal control is best .Because it is light weight and will not generate any span tags.

2.Localization will cause slow response:

                         for every resource file asp.net engine compiles and  creates separate dll  in runtime.
      
Recommended way:Don't use too many local resources files .Instead of localization better to use globalization (wherever required )
 
3.Implicit Declaration vs. Explicit declaration

                         If you have value which is using more than one place then use Explicit declaration with Global resources .
 

4. Assembly vs. satellite Assembly

                             When you make a change to a default resource file, either local or global  ASP.NET recompiles the resources and restarts the ASP.NET application . This can affect the overall performance of your site. If you add satellite resource files,  it does not cause a recompilation of resources, but the ASP.NET application will restart.don't required any special mechanism.Just follow the naming standard's automatically in runtime CLR creates  satellite assembly .