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 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.
Right click on project in the solution explorer and select Manage NuGet Packages..

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.
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.
Entity Framework Tutorial Basics(4):Setup Entity Framework Environment的更多相关文章
- Entity Framework Tutorial Basics(27):Update Entity Graph
Update Entity Graph using DbContext: Updating an entity graph in disconnected scenario is a complex ...
- Entity Framework Tutorial Basics(26):Add Entity Graph
Add Entity Graph using DbContext: Adding entity graph with all new entities is a simple task. We can ...
- Entity Framework Tutorial Basics(42):Colored Entity
Colored Entity in Entity Framework 5.0 You can change the color of an entity in the designer so that ...
- 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 Tutorial Basics(40):Validate Entity
Validate Entity You can write custom server side validation for any entity. To accomplish this, over ...
- Entity Framework Tutorial Basics(1):Introduction
以下系列文章为Entity Framework Turial Basics系列 http://www.entityframeworktutorial.net/EntityFramework5/enti ...
- Entity Framework Tutorial Basics(32):Enum Support
Enum in Entity Framework: You can now have an Enum in Entity Framework 5.0 onwards. EF 5 should targ ...
- Entity Framework Tutorial Basics(31):Migration from EF 4.X
Migration from Entity Framework 4.1/4.3 to Entity Framework 5.0/6.0 To migrate your existing Entity ...
- Entity Framework Tutorial Basics(22):Disconnected Entities
Disconnected Entities: Before we see how to perform CRUD operation on disconnected entity graph, let ...
随机推荐
- ugui Event.current.mousePosition获取的坐标原点在左上角
脚本里使用OnGUI(),在鼠标按下时出发EventType.MouseDown事件,此时如果观察Event.current.mousePosition的坐标原点时左上角,即鼠标按下的点越靠近左上角, ...
- The Great Mixing
Sasha and Kolya decided to get drunk with Coke, again. This time they have k types of Coke. i-th typ ...
- Codeforces 786C. Till I Collapse 主席树
题目大意: 给定一个长度为\(n\)的序列,要求将其划分为最少的若干段使得每段中不同的数字的种数不超过\(k\). 对于 \(k = 1 .. n\)输出所有的答案. \(n \leq 10^5\) ...
- 统计数字noip2007
7909:统计数字 总时间限制: 1000ms 内存限制: 65536kB 描述 某次科研调查时得到了n个自然数,每个数均不超过1500000000(1.5*109).已知不相同的数不超过1000 ...
- 关于DO、VO的一些新的认识
今天在开发前的定案以及业务介绍过程中,讲到了一些关于VO和DO的知识和理解. 听到之后就觉得很惊奇,也或许是自己以前不够深入理解开发的过程.认知的很浅薄. DO VO以前的认知里面,都是一样的,都属于 ...
- 蓝桥杯 基础练习 BASIC-25 回形取数
基础练习 回形取数 时间限制:1.0s 内存限制:512.0MB 问题描述 回形取数就是沿矩阵的边取数,若当前方向上无数可取或已经取过,则左转90度.一开始位于矩阵左上角,方向向下. 输入格式 ...
- Redis 集群之 Redis-Cluster
Redis集群官方推荐方案 Redis-Cluster 集群 redis cluster 通过分片实࣫容量扩展 通过主从复制实࣫节点的高可用 节点之间互相通信 每个节点都维护整个集群的节点信息 red ...
- linux命令 把Windows 文件拷贝到linux
scp build.zip mesadmin@dpydalapp01.sl.bluecloud.ibm.com:/tmp // 把Windows上的build.zip拷贝到mesadmin@dpy ...
- iOS离屏渲染
为什么会使用离屏渲染 当使用圆角,阴影,遮罩的时候,图层属性的混合体被指定为在未预合成之前不能直接在屏幕中绘制,所以就需要屏幕外渲染被唤起. 屏幕外渲染并不意味着软件绘制,但是它意味着图层必须在被显示 ...
- 数据库学习笔记(二)MySQL数据库进阶
MySQL 进阶 关于连表 左右连表: join 上下连表: union #自动去重 (当两张表里的数据,有重复的才会自动去重) union all #不去重 #上下连表示例: select sid, ...