Tailspin Spyworks指南第二讲:数据访问层

Part 2: Data Access Layer 数据访问层

By  Joe Stagner |July 21, 2010
Translated By   litdwg  |March 12,2014

Tailspin Spyworks demonstrates how extraordinarily simple it is to create powerful, scalable applications for the .NET platform. It shows off how to use the great new features in ASP.NET 4 to build an online store, including shopping, checkout, and administration.

通过Tailspin Spyworks 演示在.NET平台创建功能强大,结构良好的应用程序有多么简单。演示如何使用ASP.NET 4的新特性创建一个包含购物、结算和管理功能的在线网店。

This tutorial series details all of the steps taken to build the Tailspin Spyworks sample application. Part 2 covers adding the data access layer.

本系列指南对构建案例程序的每一步做了详细的解释。第二部分讲述添加数据访问层。  

添加数据访问层

Our ecommerce application will depend on two databases.

此电子商务程序将需要两个数据库。

For customer information we'll use the standard ASP.NET Membership database. For our shopping cart and product catalog we'll implement a SQL Express database as follows.

我们将使用standard ASP.NET Membership database。购物车和产品数据将创建一个新的数据库来保存。


Having created the database (Commerce.mdf) in the application's App_Data folder we can proceed to create our Data Access Layer using the .NET Entity Framework.

在App_Data文件夹创建数据库(Commerce.mdf)之后,我们使用.NET EntityFramework创建数据访问层。(提示:也可在SQL Server标准版中直接创建此数据库)。

We'll create a folder named "Data_Access" and them right click on that folder and select "Add New Item".

创建名为“Data_Access”文件夹,然后在其上右键选择“添加新项”。

In the "Installed Templates" item and then select "ADO.NET Entity Data Model" enter EDM_Commerce.edmx as the name and click the "Add" button.

在对话框中选择“ADO.NET Entity Data Model",命名为EDM_Commerce.edmx,然后点击”添加“按钮。


Choose "Generate from Database".

选择”从数据库生成“。






Save and build.

保存并生成。

Now we are ready to add our first feature – a product category menu.

我们由此准备好添加新功能-产品目录。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值