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 ...
随机推荐
- mysql数据库优化。(强力推荐)
本文转自:https://m.aliyun.com/yunqi/articles/38809 一个成熟的数据库架构并不是一开始设计就具备高可用.高伸缩等特性的,它是随着用户量的增加,基础架构才逐渐完善 ...
- redhat5.8 alt+ctrl+f1 黑屏
/********************************************************************** * redhat5.8 alt+ctrl+f1 黑屏 * ...
- 455. Assign Cookies Add to List
Assume you are an awesome parent and want to give your children some cookies. But, you should give e ...
- Linux 终端 忽略大小写
忘了在哪里看到的了,记录一下. 在-/.inputrc中加入一行 set completion-ignore-case on 搞定! 这样在终端输入.补全时就忽略大小写了.当然,Linux本身还是区分 ...
- Operating System-进程/线程内部通信-临界区(Critical Regions)
上一篇文章讲述了进程之间的竞争条件:多个进程同时进入一个共享区域,导致了数据的不一致,本文主要介绍如何解决这个问题. 一.临界区介绍 解决这个问题就是阻止多个进程同时进入这个共享区域,换句话说,进程之 ...
- java中Swing编程再度练习篇
总结: 注意理解frame的层级关系 package com.da; //添加背景图片 //我只实现了插入图片.但并没有实现是背景图片 import javax.swing.JFrame; impor ...
- Spring集成Quartz定时任务框架介绍
在JavaEE系统中,我们会经常用到定时任务,比如每天凌晨生成前天报表,每一小时生成汇总数据等等.我们可以使用java.util.Timer结合java.util.TimerTask来完成这项工作,但 ...
- DCloud:temple
ylbtech-DCloud: 1.返回顶部 2.返回顶部 3.返回顶部 4.返回顶部 5.返回顶部 6.返回顶部 7.返回顶部 8.返回顶部 9.返回顶部 1 ...
- 创建,查看,删除pool,查看,修改pool参数命令总结
标签(空格分隔): ceph,ceph运维,pool 1. 创建pool命令: ceph的pool有两种类型,一种是副本池,一种是ec池,创建时也有所区别 1.1 创建副本池: $ sudo ceph ...
- urllib2模块中文翻译与学习 - Python 2.7.8官方文档
总结 目的 打开指定网址 要求 了解需要处理的网站的操作流程 数据包的构造与提交 对可能的响应处理选择合适的处理器(模块内的各种 *Handler()) 核心 urllib.urlencode(que ...