Entity Framework Tutorial-Installing the Entity Framework Environment

Source: Internet
Author: User

Installing the Entity Framework Environment

The Entity Framework 5.0 API is distributed in two locations, one can be found in the NuGet Package Manager, and one exists in the. NET Framework. NET Framework 4.0/4.5 contains the EF core API. The EntityFramework.dll downloaded through the NuGet Package Manager contains special features for EF5.0.

However, in EF6.0, you only need to download EntityFramework.dll from the NuGet Package Manager and not rely on the. NET framework.

This basic tutorial is written using the EF6.0 version. Please install the following tools before learning:

    • NET Framework 4.5
    • Visual Studio 2012
    • MS SQL Server 2005/2008/2012 Express

Installing EF through NuGet

You can install EF (EntityFramework.dll) through the NuGet Package Manager, and you can choose different versions in the same way.

Right-click on the solution and select NuGet Package Manager.

The NuGet Package Manager dialog box pops up and opens the online option on the left and looks for entityframework.

This will find all the packages related to the Entity Framework. Select the Entity Framework and click Install.

Click the Consent button in the License Authorization dialog box to start the installation.

After the installation is complete, make sure your project contains EntityFramework.dll.

Now you can use the Entity Framework in your project!

Installing the Database

The tutorial uses a simple database schooldb, which contains multiple tables, stored procedures, and views, designed as follows:

The above database has the following relationship to demonstrate:

    • One-to-one: student tables and studentaddress tables are one-to-one relationships. Student have 0 or one studentaddress.
    • One-to-many: the standard table and the teacher table are one-to-many relationships. Multiple teacher are associated to a standard.
    • Many-to-many: the student table and the course table have many-to-many relationships, and two tables are linked through the StudentID and CourseID columns of the Studentcourse table. So a student can take more than one course, and a class with multiple students.

Download the project

The project contains database scripts and EF design models.

Entity Framework Tutorial-Installing the Entity Framework Environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.