Try one ORM: Entity Framework

database
Database @Image courtesy of ddpavumba/ FreeDigitalPhotos.net

Try one ORM: Entity Framework

Welcome to CodeSpread!

As promised in the last article, We are going to share our experience of Entity Framework Ver 4.1.

First of all, we have to add and configure Entity Framework in visual studio. We are going to use “NuGet” manager.

Steps to check whether “NuGet” manager is already installed.

1)Open Visual Studio 2010, Go to Tools menu and click on Library Package Manager.

Console

If NuGet is not installed,Follow the below steps to install it through Extension Manager.

1)Open Visual Studio 2010, Go to Tools menu and click on Extension Manager.

extension

2) On left hand side, you will find Online Gallery, Click on it.

NuGet

3) Download NuGet Package Manager and install it.

InstallNuGet

InstallComplete

What is NuGet Package Manager?

From codeplex “NuGet is a free, open source developer focused package management system for the .NET platform intent on simplifying the process of incorporating third-party libraries into a .NET application during development.”

We use several third party libraries in the project development and have to each location for the library and integrate the library in our project which is quite a painful process in the long run. NuGet heals the process by introducing a package management which streamline the process of sharing and using open source libraries.

Steps to add Entity Framework:

1)Go to Project,Click on Manage NuGet Packages.

ManageNuGet

2) Search for Entity Framework and Install.

EF1

3) Our recommendation is to download POCO also. Open Extension Manager again and Go to online Gallery, Here search for EF.

EF

2)Download and Install EF 4.x POCO Entity generator for c#

EFInstall

We will provide a more detailed article for POCO sometime in future as it can’t be covered in one or two lines.

To see the results of successful installation, Add new item to the project and see Entity Data Model Template in the window.

EDMX

EDMX

Later, we will use these models to demonstrate “Model First Approach” and “Code First Approach”.

Author: hershey

A passion for knowledge drives me to do programming, A passion for programming drives me to create something different, A passion for creation drives me to spread the knowledge.

Share This Post On

0 Comments

  1. nice superb explaination

    Post a Reply
  2. thanks for the tutorial
    I am having a problem.
    The feature “Create SQL server database” isn’t available , I can’t select it.
    Can you help, please ?

    Post a Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

More from CodeSpread:

  • Magic Wand: Object-relational mappingMagic Wand: Object-relational mappingAs a developer, we are always looking for reusable components which can ease our life and I can suggest ORM as the developer's magic wand because it wipes off the overhead of dealing directly with ...
  • POCO vs Custom Classes/DTOPOCO vs Custom Classes/DTOWhen I started working on Entity Framework, I didn't catch the idea of POCO initially. I started with custom classes and later came to know the advantages of POCO over custom classes. What is POCO...
  • EDMX file.EDMX file.Few lines about Entity Framework The Entity Framework is an object-relational mapping framework or O/RM.For more info on O/RM refer Magic Wand: Object-relational mapping. It was released with .NET...
  • WCF Part 3: Direct from WCF kitchen.WCF Part 3: Direct from WCF kitchen.In the last two articles WCF:Part 1 and WCF Part 2, we have covered basic knowledge and terminologies of WCF.Now we will apply that knowledge to create a WCF service.There are lot of articles avail...
  • How to make a Connection between c# and mysql?How to make a Connection between c# and mysql?This is my first article on codespread.com, titled ‘Connection between c# and mysql’.Before going into details, we should know that mysql is a open source software for data base management system. ...
  • Unused Useful Tools in Visual StudioUnused Useful Tools in Visual StudioBack from a vacation is always a great and refreshing feeling. A small break always adds a new dimension to the thoughts. Lets see what we have today which we can call ‘new’ . We are good workin...
  • How to create database with SQL express bundled with Visual Studio?How to create database with SQL express bundled with Visual Studio?Yes, Visual studio comes bundled with a copy of SQL express edition which gets installed during visual studio installation. These steps are required to create database with SQL express bundled w...
  • Windiff saved my effort. How it is useful?Windiff saved my effort. How it is useful?While working with TFS [Team foundation server],we get used of the compare feature to compare the 'local version', 'server version','workspace version'. We had some similar situation when we rec...