Tuesday 3 February 2015

What is entity Framework

Entity FrameWork  is a ORM framework. ORM stands for  "Object Relational Mapping " .

Use of ORM framework to creates the classes of database table and vice versa.

Why we Use  Entity FrameWork  The main and the only benefit of EF is it auto-generates code for the Model (middle layer), Data Access Layer, and mapping code, thus reducing a lot of development time.

Difference b/w ADO.NET and Entity Framework 
The main use of EF is that it is directly create object of database tables and the process of updating the database. Its also reduce the lot of  development work otherwise We have to write and maintain code.  Further, because the mapping between your objects and your database is specified declaratively instead of in code. In EF Actually queries are written in LINQ. Except EF when we write any query we have to write different query for different database but when we write any query in linq its support all database. So that EF is very useful.

Creating the model from database:
STEP -1 :Open the new project  and give the name of that project.
STEP 2 : Install entity framework
(A)        : Go to tools and click on Extensions and Updates.

In this screen click on online and search “nueget package manager” and install it.

(B)        After installing “nueget package manager”  you will see a new node as “nueget package manager” in tools

(C)        Click on Manage NuGet Package For solution and Search for “ entity framework” (nugget.orgs) and install it.

STEP 3 : Right click on solution explorer and add new item and select  “ADO.NET Entity DataModal” and give the name for this

Step(4) : When you will click on add you will see this following screen. Select EF designer from database and click on Next and give the connection Once the database has been selected, the wizard will generate the Entity connection string. This is something like a regular database connection string. The only difference is that it contains more information on the Entity Framework model. and give the name of App.config file

Step(5): After click on next you will see your database tables from here you select you table name (you also can say class objects).

After  select  tables click on finish  now you will see  your these tables as  entity data maodal as a relation.

This is the way for creating a Entity database modal. 

No comments:

Post a Comment

C# program Selection Sorting

Selection sort is a straightforward sorting algorithm. This algorithm search for the smallest number in the elements array and then swap i...