.NET Application Voyage pt 1

ron naber
.NET voyage
Published in
2 min readOct 25, 2014

--

corners,struggles,knowledge and fun

Journey in the sea of .NET

Entity framework

Definition in 1 word :

Entity Framework is an Object Relational Mapper (ORM).

Little more definition :

It basically generates business objects and entities according to the database tables and provides the mechanism for:
Performing basic CRUD (Create, Read, Update, Delete) operations.
Easily managing “1 to 1", “1 to many”, and “many to many” relationships.
Ability to have inheritance relationships between entities.

Benefits :

so major benefit is that we can code database in our c# code itself instead of having t-sql code.
another major benefit is type safety of code and fast execution.

Why to use it again :

Entity framework sits between your database and application , but does that mean that ado.net has become obsolete ?
No Entity framework uses ado.net but think of Entity framework as a tool which helps you use ado.net better.
Lets be honest who wants to use data reader and data set classes , i love entity framework.

So what if you already have database of your application ? or you dont have database ?

There are two ways you can work on Entity framework — Database first and Code first

If you already have database , you just have to create Entity model of that database (.Edmx file).

It copies all the mappings and tables and constraints to that model and viola within minutes you start working on your database.

If you do not have database , then just code first and let entity framework create underlying classes for you.

--

--

ron naber
.NET voyage

writing sets you free , lets you explore and enjoy life more, so read n write