程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> SqlServer數據庫 >> 關於SqlServer >> SQL2008 LINQ to Entity

SQL2008 LINQ to Entity

編輯:關於SqlServer

准備工作

預計完成本實驗所需的時間

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,創建一個新的網站。

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved