1.The Contoso University sample web application demonstrates how to create asp.net MVC 5 applications using the Entity Framework 6 and Visual Studio 2013. This tutorial uses the Code First workflow. For information about how to choose between Code First, Database First, and Model First, seeEntity Framework Development Workflows.(這個(gè)網(wǎng)站的例子,向我們展示了,怎樣使用EF6和VS2013來(lái)創(chuàng)建ASP.NET MVC5應(yīng)用程序。這個(gè)系列的課程使用了Code First工作流。要了解怎么在Code First,Database First 和Model First之間進(jìn)行選擇,請(qǐng)看鏈接這篇文章。)
2.The sample application is a web site for a fictional Contoso University. It includes functionality such as student admission, course creation, and instructor assignments. This tutorial series explains how to build the Contoso University sample application. You candownload the completed application.
(這個(gè)示例程序是為Contoso University虛構(gòu)的一個(gè)網(wǎng)站。網(wǎng)站的功能包含:招生模塊,課程的創(chuàng)建模塊,布置作業(yè)模塊,這個(gè)系列的課程將帶你創(chuàng)建這個(gè)網(wǎng)站,你可以通過(guò)這個(gè)鏈接下載完整的網(wǎng)站源代碼。)
3.課程中用到的軟件環(huán)境:
The application you'll be building in these tutorials is a simple university web site.(在這個(gè)系列課程中,你將要?jiǎng)?chuàng)建的是一個(gè)大學(xué)的簡(jiǎn)單web網(wǎng)站)
Users can view and update student, course, and instructor information. Here are a few of the screens you'll create.(你可以瀏覽,更新學(xué)生、課程信息,和老師信息,這里的一些頁(yè)面,將是你將來(lái)要?jiǎng)?chuàng)建的。)


The UI style of this site has been kept close to what's generated by the built-in templates, so that the tutorial can focus mainly on how to use the Entity Framework.(這個(gè)網(wǎng)站的界面樣式,使用的是默認(rèn)提供的模板樣式,所以這個(gè)課程將會(huì)把主要的精力放在,怎樣去使用EF上面。PS:后面我會(huì)自己使用EasyUI和Bootstrap自己把界面美化一下。)
Open Visual Studio and create a new C# Web PRoject named "ContosoUniversity".(打開(kāi)VS,創(chuàng)建一個(gè)新的web項(xiàng)目,取名為ContosoUniversity)

In theNew ASP.NET Projectdialog box select theMVCtemplate. (在新的ASP.NET項(xiàng)目中,選擇MVC模板)
If theHost in the cloudcheck box in theMicrosoft Azuresection is selected, clear it.(如果在云中托管被選中了,請(qǐng)取消勾選)
ClickChange Authentication.(點(diǎn)擊更改身份驗(yàn)證)

In theChange Authenticationdialog box, selectNo Authentication, and then clickOK. For this tutorial you won't be requiring users to log on or restricting access based on who's logged on.(在更改身份驗(yàn)證的對(duì)話框中,選擇無(wú)身份驗(yàn)證,然后點(diǎn)擊確定。這個(gè)系列的課程,你不會(huì)被要求,需要讓用戶來(lái)登錄,或者限制用戶登錄)

Back in the New ASP.NET Project dialog box, clickOKto create the project. (返回到新建ASP.NET項(xiàng)目的界面,點(diǎn)擊確定,創(chuàng)建新項(xiàng)目)
A few simple changes will set up the site menu, layout, and home page.(我們會(huì)對(duì)菜單,樣式,和主頁(yè)做一些細(xì)微的改變)
OpenViews/Shared/_Layout.cshtml, and make the following changes:(打開(kāi)Views/Shared/_Layout.cshtml文件,做如下改變)
The changes are highlighted.(這些改變都做了高亮顯示:)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 5 <meta charset="utf-8" /> 6 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 7 <title>@ViewBag.Title - WuHan University</title> 8 @Styles.Render("~/Content/CSS") 9 @ScrInViews/Home/Index.cshtml, replace the contents of the file with the following code to replace the text about ASP.NET and MVC with text about this application:(在Views/Home/Index.cshtml中,用下面的代碼,來(lái)代替它)
1 @{ 2 ViewBag.Title = "主頁(yè)"; 3 } 4 5 <div class="jumbotron"> 6 <h1>WuHan University</h1> 7 </div> 8 <div class="row"> 9 <div class="col-md-4">10 <h2>Welcome to WuHan University</h2>11 <p>12 WuHan University is a sample application that13 demonstrates how to use Entity Framework 6 in an14 ASP.NET MVC 5 web application.15 </p>16 </div>17 <div class="col-md-4">18 <h2>Build it from scratch</h2>19 <p>You can build the application by following the steps in the tutorial series on the ASP.NET site.</p>20 <p><a class="btn btn-default" >See the tutorial »</a></p>21 </div>22 <div class="col-md-4">23 <h2>Download it</h2>24 <p>You can download the completed project from the Microsoft Code Gallery.</p>25 <p><a class="btn btn-default" >Download »</a></p>26 </div>27 </div>Press CTRL+F5 to run the site. You see the home page with the main menu.(按一下CTRL+F5,來(lái)運(yùn)行項(xiàng)目,你可以看到:)

Install Entity Framework 6(安裝EF6)
From theToolsmenu clickNuGet Package Managerand then clickPackage Manager Console.(點(diǎn)擊工具-->NuGet程序包管理器--->程序包管理器控制臺(tái))
In thePackage Manager Consolewindow enter the following command:(在程序包管理器控制臺(tái)窗口里,輸入下面的指令:)
Install-Package EntityFramework

The image shows 6.0.0 being installed, but NuGet will install the latest version of Enti
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注