Entity Framework tutorial -- install Entity Framework environment, entityframework

Source: Internet
Author: User

Entity Framework tutorial -- install Entity Framework environment, entityframework

Install the Entity Framework Environment

Entity Framework 5.0 APIs are distributed in two places. One can be found in the NuGet Package Manager and the other exists in the. NET framework .. NET framework 4.0/4.5 contains EF core APIs. EntityFramework. dll downloaded through the NuGet Package Manager contains the special functions of EF5.0.

However, in EF6.0, you only need to download EntityFramework. dll from the NuGet Package Manager, instead of relying on. NET framework.

This basic tutorial is written in EF6.0. Install the following tools before learning:

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

Install EF through NuGet

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

Right-click solution and select NuGet Package Manager.

The NuGet Package Manager dialog box is displayed. Open the Online option on the left and search for EntityFramework.

This searches for all the packages related to the Entity Framework. Select the Entity Framework and install it.

Click agree in the license authorization dialog box to start installation.

After installation, make sure that your project contains EntityFramework. dll.

Now you can use Entity Framework in your project!

Install Database

This tutorial uses a simple database SchoolDB, which contains multiple tables, stored procedures, and views. Its design is as follows:

The above databases have the following relationships for Demonstration:

  • One-to-one relationship: Student table and StudentAddress table. Student has zero or one StudentAddress.
  • One-to-multiple: The Standard table and Teacher table have one-to-multiple relationships. Multiple teachers are associated with a Standard.
  • Many-to-many: the Student table has many-to-many relationships with the Course table, and uses the StudentId column and CourseId column of the StudentCourse table to link two tables. Therefore, one student can attend multiple courses, and multiple students can attend one course.

Download Project

This project contains the database script and EF design model.

Related Article

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.