加入收藏 | 设为首页 | 会员中心 | 我要投稿 济南站长网 (https://www.0531zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

SQL2008 LINQ to Entity

发布时间:2016-09-11 13:05:56 所属栏目:MsSql教程 来源:站长网
导读:准备工作 预计完成本实验所需的时间 40 分钟 目标 在完成本实验后,您将可以: 创建数据库的实体数据模型 使用LINQ查询语言访问实体数据模型 先决条件 在完成本
准备工作

预计完成本实验所需的时间

40 分钟

目标

在完成本实验后,您将可以:

•创建数据库的实体数据模型

•使用LINQ查询语言访问实体数据模型

先决条件

在完成本实验前,您必须具有:

•使用C#编写ADO.NET数据访问技术的相关经验。

实验场景

A trend among database developers is to define high-level business objects, or entities, that they then map to the tables and columns stored in a database. Rather than programming against tables and columns in a database, developers use high-level entities such as ‘Customer’ or ‘Order’ to represent the underlying data. The ADO.NET Entity Framework enables developers to program against relational data in terms of such entities. Programming at this level of abstraction is highly productive and allows developers to take full advantage of entity-relationship modeling.

The object services layer of ADO.NET enables the materialization, change tracking, and persistence of data as Common Language Runtime (CLR) objects. Developers using the ADO.NET Entity Framework can program against a database by using CLR objects that are managed by ADO.NET. SQL Server 2008 introduces more efficient, optimized support that improves performance and simplifies development.

Microsoft Language Integrated Query (LINQ) enables developers to issue queries against data by using a managed programming language such as C# or Visual Basic.NET, instead of SQL statements. LINQ enables seamless, strongly typed, set-oriented queries written in .NET Framework languages to run against ADO.NET (LINQ to SQL), ADO.NET DataSets (LINQ to DataSets), the ADO.NET Entity Framework (LINQ to Entities), and to the Entity Data Service Mapping Provider. SQL Server 2008 features a new LINQ to SQL Provider that enables developers to use LINQ directly on SQL Server 2008 tables and columns.

虚拟机环境

1.从开始菜单或桌面上启用Microsoft Virtual PC 。如果Virtual PC 控制台没有启用,请查看系统托盘,然后双击系统托盘当中的Microsoft Virtual PC 。

2.选择Sql08 然后点击Start。

3.在虚拟机运行起来后,可以通过点击右Alt+Del 来向虚拟机发送一个Ctrl+Alt+Del 命令。

4.在登录窗口中,输入以下信息:

•User name: administrator

•Password: password01!

创建Web应用程序

1.点击Start | All Programs | Microsoft Visual Studio 2008 | Microsoft Visual Studio 2008,启动Microsoft Visual Studio 2008集成开发环境。

2.在菜单中,点击 File | New | Web Site 来打开 New Web Site对话框。

3.然后,选择 ASP.NET Web Site 模板,在 Location中选择File System,然后在Language下拉列表中选择Visual C#,点击OK,创建一个新的网站。

(编辑:济南站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读