SQL Server安装Entity Framework【Setup Entity Framework Environment】(EF基础系列篇4)

Entity Framework 5.0 API是遍布在点滴独地方:NuGet和.NET Framework中,这个.NET framework 4.0/4.5包含EF核心的API,然而经过NuGet包拿走之EntityFramework.dll包含EF 5.0特别的特征;EF6.0中未是分手的:

Entity Framework 5.0 API
was distributed in two places, in NuGet package and in .NET framework.
The .NET framework 4.0/4.5 included EF core API, whereas
EntityFramework.dll via NuGet package included EF 5.0 specific
features.

This has been changed
with EF 6.0 which is included in EntityFramework.dll only and is not
dependent on .NET framework.

SQL Server 1

SQL Server 2

 

For the basic tutorials,
we will use EF 6.0, the latest version of entity framework as of this
writing.

Install the following
tools to work with entity framework:

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

每当是基础之一连串课程中,我拿会使EF 6.0,这个最新的EF版本来学,

读EF,首先使设置下面的家伙:

.NET Framework 4.5

Visual Studio 2012/2013/2015

MS SQL Server2005/2008/2012/2014 Express

脚我们来探视怎么安装EF吧:

咱开拓VS2012新建项目:

SQL Server 3

接下来,我们选中“项目名称”,点击右键,选择“管理Nuget程序包”,在弹出来的界面中,输入:”EntityFramework”,会活动查询及EntityFramework,然后点击安装,按照自下的图示进行就可以了:

SQL Server 4

SQL Server 5

SQL Server 6

安到位后,是这般的:然后倒闭是窗口就尽了。。。

SQL Server 7

 

开创数据库:

斯系列课程中,我将见面下SchoolDB样例数据库,它含有数据表,存储过程,和视图;数据库的计划如下:

SQL Server 8

 

You can see in the above
diagram that the sample SchoolDB database includes tables with the
following relationships, for demo purpose.

  • One-to-One: Student and
    StudentAddress have a one-to-one relationship eg. Student has zero
    or one StudentAddress.
  • One-to-Many: Standard
    and Teacher have a one-to-many relationship eg. many Teachers can be
    associate with one Standard.
  • Many-to-Many: Student
    and Course have a many-to-many relationship using StudentCourse
    table where StudentCourse table includes StudentId and CourseId. So
    one student can join many courses and one course also can have many
    students.

Download Sample
Project for
all the tutorials on entity framework.

Let’s create first simple
Entity Data Model for sample School database in the next section.

 

于这数图中,我们得望,不同表之间的关联:

相当:Student and StudentAddress表之间是相当的涉,例如一个Student有0到1单之StudentAddress;

平等对大多:Standard and Teacher表之间是平等针对性多之关联,例如很多Teacher关联一个Standard;

大抵对多:Student and Course表之间是基本上针对性几近干,通过中表StudentCourse 联系在齐,例如;一个生好挑选多科目,同时一个科目可以发广大学童来摘取;

 

好了,EF的安装就到这个,相信大家早就学会了,后面同样节省自我即将学习一个简练的实业数据模型来创造数据库。

 

相关文章