you should be aware of basic working experience with visual studio
Souce: CodeProject |
In this Article I am going to set up environment MVC project with EF
Entity Framework introduced Code-First approach from Entity Framework 4.1. Code-First is mainly useful in Domain Driven Design. With the Code-First approach, you can focus on the domain design and start creating classes as per your domain requirement rather than design your database first and then create the classes which match your database design. Code-First APIs will create the database on the fly based on your entity classes and configuration.
As a developer, you first start by writing C# or VB.net classes and context class. but I will start with c# When you run the application, Code First APIs will create the new database (if it does not exist yet) and map your classes with the database using default code-first conventions. You can also configure your domain classes to override default conventions to map with database tables using DataAnnotation attributes or fluent API.
The basic workflow would be:
Write application domain classes and context class→ configure domain classes for additional mapping requirements → Hit F5 to run the application → Code First API creates new database or map existing database with domain classes → Seed default/test data into the database → Finally launches the application
What is Application Domain class or context classes or seed , For now just keep them in your mind as Class with some properties and methods. I will explore these word in deep in upcomming articles
I have installed following. but you following along me with any of the version of visual studio 2010+ any sql server
- .NET Framework 4.5.2
- Visual Studio 2015
- MS SQL Server 2012 Express
3. Right click on your project in the solution explorer and select Manage NuGet Packages.
4. This will open Manage NuGet Packages dialogue box.
5. This will search for all the packages related to Entity Framework. Select EntityFramework and click on Install.
6. press ok for first pop up if come.
7. Click on the I Accept button in the License Acceptance dialogue box to start the installation.
8. After installation, make sure that the appropriate version of EntityFramework.dll is included in the project.
Finally your project is setup for your mvc project with EntityFramework.
download this project at Link
Post a Comment