安装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.


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新建项目:

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



安装完成之后,是这样的:然后关闭这个窗口就行了。。。

创建数据库:
这个系列课程中,我将会使用SchoolDB样例数据库,它包含数据表,存储过程,和视图;数据库的设计如下:

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的安装就到此,相信大家已经学会了,后面一节我将要学习一个简单的实体数据模型来创建数据库。
安装Entity Framework【Setup Entity Framework Environment】(EF基础系列篇4)的更多相关文章
- EF框架组件详述【Entity Framework Architecture】(EF基础系列篇3)
我们来看看EF的框架设计吧: The following figure shows the overall architecture of the Entity Framework. Let us n ...
- EF中的实体类型【Types of Entity in Entity】(EF基础系列篇8)
We created EDM for existing database in the previous section. As you have learned in the previous se ...
- 实体之间的关系【Entity Relationships】(EF基础系列篇9)
Here, you will learn how entity framework manages the relationships between entities. Entity framewo ...
- 【Basics of Entity Framework】【EF基础系列1】
EF自己包括看视频,看MSDN零零散散的学了一点皮毛,这次打算系统学习一下EF.我将会使用VS2012来学习这个EF基础系列. 现在看看EF的历史吧: EF版本 相关版本特性介绍 EF3.5 基于数据 ...
- 1.翻译:EF基础系列--什么是Entity Framework?
大家好,好久不见,EF系列之前落下了,还是打算重新整理一下. 先说说目前的打算:先简单了解一下EF基础系列-->然后就是EF 6 Code-First系列-->接着就是EF 6 DB-Fi ...
- 10.翻译:EF基础系列---EF中的持久性
原文链接:http://www.entityframeworktutorial.net/EntityFramework4.3/persistence-in-entity-framework.aspx ...
- EF是啥?【What is Entity Framework?】(EF基础系列2)
EF产生的背景: 编写ADO.NET访问数据的代码,是沉闷而枯燥的,所以微软提供了一个对象关系映射框架(我们称之为EF),通过EF可以自动帮助我们的程序自动生成相关数据库. Writing and m ...
- 实体生命周期【Entity Lifecycle】(EF基础系列10)
Before we work on CRUD operation (Create, Read, Update, Delete), it's important to understand the en ...
- 3.翻译:EF基础系列--EF怎么工作的?
原文链接:http://www.entityframeworktutorial.net/basics/how-entity-framework-works.aspx 这里,你将会大概了解到EF是怎么工 ...
随机推荐
- C#基础_单例模式
控制某个类型的实例数量-唯一一个 class Program { static void Main(string[] args) { test t1 = test.GetInstance(); tes ...
- CYQ.Data V5 MDataTable 专属篇介绍
前言 以前一两个月才出一篇,这三天有点变态地连续1天1篇(其实都是上周末两天写好的存货). 短期应该没有新的和此框架相关的文章要写了,这应该是最后一篇,大伙且看且珍惜. 前两篇讲数据库读写分离和分布式 ...
- 一劳永逸:域名支持通配符,ASP.NET Core中配置CORS更轻松
ASP.NET Core 内置了对 CORS 的支持,使用很简单,只需先在 Startup 的 ConfigureServices() 中添加 CORS 策略: public void Configu ...
- 剑指Offer面试题:11.打印1到最大的n位数
一.题目:打印1到最大的n位数 题目:输入数字n,按顺序打印出从1最大的n位十进制数.比如输入3,则打印出1.2.3一直到最大的3位数即999. 二.不同的解法 2.1 不假思索的解法 最容易想到的办 ...
- Chrome 控制台新玩法-console显示图片以及为文字加样式
有兴趣的同学可以文章最后的代码复制贴到控制台玩玩. Go for Code 在正常模式下,一般只能向console 控制台输出简单的文字信息.但为了把信息输出得更优雅更便于阅读,除了cosole.lo ...
- OpenGL快问快答
OpenGL快问快答 本文内容主要来自对(http://www.opengl.org/wiki/FAQ)的翻译,随机加入了本人的观点.与原文相比,章节未必完整,含义未必雷同,顺序未必一致.仅供参考. ...
- Maven 最佳实践
持续不断地学习maven Maven是一个很好的工具,但同时也拥有陡峭的学习曲线.因此,将 http://books.sonatype.com/mvnref-book/reference/ 加入到你的 ...
- Android开发学习之路-Android N新特性-多窗口模式
我们都知道,在最新的Android N系统中,加入了一个新的功能,就是多窗口模式.多窗口模式允许我们在屏幕上显示两个窗口,每个窗口显示的内容不同,也就是说,我们可以一遍看电视剧,一边聊微信. 这里我们 ...
- Report processing of Microsoft Dynamic AX
Report processing of Microsoft Dynamic AX 版权声明:本文为博主原创文章,未经博主允许不得转载. The implementation of a general ...
- spring定时任务之quartz
在Spring中,使用JDK的Timer类库来做任务调度功能不是很方便,关键它不可以象cron服务那样可以指定具体年.月.日.时和分的时间.你只能将时间通过换算成微秒后传给它.如任务是每天执行一次,则 ...