Setup Entity Framework Environment
http://www.entityframeworktutorial.net/EntityFramework5/setup-entityframework-environment.aspx
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
Install EF via Nuget:
You can install entity framework into your project via nuget.
Here, we will install EF (EntityFramework.dll) via nuget in the console application in VS 2012.
You can install EF via NuGet the same way in any version of Visual Studio.
右键项目,然后选择“管理NuGet程序包”
Right click on project in the solution explorer and select Manage NuGet Packages..
然后选择联机,并搜索EntityFramework
This will open Manage NuGet packages dialogue box. Now, select Online in left bar and search for EntityFramework as shown below.
最后安装
This will search for all the packages related to Entity Framework. Select EntityFramework and click on Install.
Click on the I Accept button in License Acceptance dialogue box. This will start the installation.
After installation, make sure that the appropriate version of EntityFramework.dll is included in the project.
Now, you are ready to use Entity Framework in your project.
Setting up the database:
This tutorial will use sample SchoolDB which has different tables, stored procedures and views. The SchoolDB database design is shown below:
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.
学生和学生地址,是一对一的关系,学生有一个或0个地址
标准和老师,是一对多的关系,一个标准可以针对于多个老师
学生和课程,是多对多的关系,1个学生可以选修多门课程;一门课程,可以有多个学生选修
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.
Setup Entity Framework Environment的更多相关文章
- Entity Framework Tutorial Basics(4):Setup Entity Framework Environment
Setup Entity Framework Environment: Entity Framework 5.0 API was distributed in two places, in NuGet ...
- 安装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包 ...
- EF(Entity Framework)系统学习系列
好久没写博客了,继续开启霸屏模式,好了,废话不多说,这次准备重新系统学一下EF,一个偶然的机会找到了一个学习EF的网站(http://www.entityframeworktutorial.net/) ...
- Entity Framework Code-First(3):Setup Environment
Setup Development Environment for EF Code-First: Let's setup the development environment for Code-Fi ...
- ASP.NET: Setup a MVC5 website with MySQL, Entity Framework 6 Code-First and VS2013
The new features available in EF6 allow any developer to build a simple DB-powered website with very ...
- Entity Framework 6, database-first with Oracle
Entity Framework 6, database-first with Oracle 转载自http://csharp.today/entity-framework-6-database-fi ...
- Managing DbContext the right way with Entity Framework 6: an in-depth guide by mehdime
UPDATE: the source code for DbContextScope is now available on GitHub: DbContextScope on GitHub. A b ...
- Entity Framework Tutorial Basics(5):Create Entity Data Model
Create Entity Data Model: Here, we are going to create an Entity Data Model (EDM) for SchoolDB datab ...
- 《Entity Framework 6 Recipes》中文翻译系列 (13) -----第三章 查询之使用Entity SQL
翻译的初衷以及为什么选择<Entity Framework 6 Recipes>来学习,请看本系列开篇 3-4使用实体SQL查询模型 问题 你想通过执行Entity SQL语句来查询你的实 ...
随机推荐
- 【NOI模拟赛(湖南)】DeepDarkFantasy
DeepDarkFantasy 从东京出发,不久便到一处驿站,写道:日暮里. ——鲁迅<藤野先生> 定义一个置换的平方为对1~n的序列做两次该置换得到的序列.已知一个置换的平方,并且这个 ...
- NGUI 笔记
1.动态加载Atlas,并用NGUITools添加Sprite UIAtlas MyAtlas = Resources.Load("MyAtlas", typeof(UIAtlas ...
- NVelocity 在.Net的三种用法
NVelocity 使用文件型模板例子 using NVelocity; using NVelocity.App; using NVelocity.Runtime; VelocityEngine vl ...
- 13test05:亲密数
/*#include<iostream> using namespace std; int main() {int sum[3000]={0}; for(int i=1;i<3000 ...
- asp.net @reqister指令
@register指令通过声明将自定义 ASP.NET 服务器控件添加到页或用户控件中. 1.@register 指令有两种用法如下 <%@ Register tagprefix="t ...
- 翻译 - NodeJS错误处理最佳实践
王龑 - APRIL 13, 2015 NodeJS的错误处理让人痛苦,在很长的一段时间里,大量的错误被放任不管.但是要想建立一个健壮的Node.js程序就必须正确的处理这些错误,而且这并不难学.如果 ...
- Android开发者:你真的会用AsyncTask吗?
[导读]在Android应用开发的过程中,我们需要时刻注意保证应用程序的稳定和UI操作响应及时,因为不稳定或响应缓慢的应用将给应用带来不好的印象,严重的用户卸载你的APP,这样你的努力就没有体现的价值 ...
- B树、B-树、B+树、B*树---转载
B树 即二叉搜索树: 1.所有非叶子结点至多拥有两个儿子(Left和Right): 2.所有结点存储一个关键字: 3.非叶子结点的左指针指向小于其关键字的子树,右指针指向大于其关键字的子树: 如: B ...
- cf div2 238 D
D. Toy Sum time limit per test 1 second memory limit per test 256 megabytes input standard input out ...
- ios 团购分类页面(9宫格)
=-= 命名有些错误,但功能实现,以后注意下命名规范 WJViewGroup.h #import <UIKit/UIKit.h> @interface WJViewGroup : UIVi ...