Professional ADO.NET 3.5 with LINQ and the Entity Framework (Paperback)
暫譯: 專業 ADO.NET 3.5 與 LINQ 及實體框架
Roger Jennings
- 出版商: Wrox Press
- 出版日期: 2009-02-03
- 售價: $1,920
- 貴賓價: 9.5 折 $1,824
- 語言: 英文
- 頁數: 672
- 裝訂: Paperback
- ISBN: 047018261X
- ISBN-13: 9780470182611
-
相關分類:
.NET、Entity
已絕版
買這商品的人也買了...
-
$1,880$1,786 -
$880$695 -
$1,200$948 -
$550$468 -
$880$748 -
$650$553 -
$980$774 -
$620$490 -
$2,200$2,090 -
$3,380$3,211 -
$690$587 -
$480$379 -
$1,188Professional Refactoring in C# & ASP.NET (Paperback)
-
$650$514 -
$750$593 -
$520$442 -
$299Beginning JavaScript and CSS Development with jQuery (Paperback)
-
$399Silverlight 3 Programmer's Reference (Paperback)
-
$500$425 -
$540$459 -
$1,920$1,824 -
$490$417 -
$650$507 -
$490$417 -
$790$672
相關主題
商品描述
Language Integrated Query (LINQ), as well as the C# 3.0 and VB 9.0 language extensions to support it, is the most import single new feature of Visual Studio 2008 and the .NET Framework 3.x. LINQ is Microsoft’s first attempt to define a universal query language for a diverse set of in-memory collections of generic objects, entities persisted in relational database tables, and element and attributes of XML documents or fragments, as well as a wide variety of other data types, such as RSS and Atom syndication feeds. Microsoft invested millions of dollars in Anders Hejlsberg and his C# design and development groups to add new features to C# 3.0—such as lambda expressions, anonymous types, and extension methods—specifically to support LINQ Standard Query Operators (SQOs) and query expressions as a part of the language itself.
Corresponding additions to VB 9.0 followed the C# team’s lead, but VB’s implementation of LINQ to XML offers a remarkable new addition to the language: XML literals. VB’s LINQ to XML implementation includes XML literals, which treat well-formed XML documents or fragments as part of the VB language, rather than requiring translation of element and attribute names and values from strings to XML DOM nodes and values.
This book concentrates on hands-on development of practical Windows and Web applications that demonstrate C# and VB programming techniques to bring you up to speed on LINQ technologies. The first half of the book covers LINQ Standard Query Operators (SQOs) and the concrete implementations of LINQ for querying collections that implement generic IEnumerable This book is intended for experienced .NET developers using C# or VB who want to gain the maximum advantage from the query-processing capabilities of LINQ implementations in Visual Studio 2008—LINQ to Objects, LINQ to SQL, LINQ to DataSets, and LINQ to XML—as well as the object/relational mapping (O/RM) features of VS 2008 SP1’s Entity Framework/Entity Data Model and LINQ to Entities and the increasing number of open-source LINQ implementations by third-party developers. Basic familiarity with generics and other language features introduced by .NET 2.0, the Visual Studio integrated development environment (IDE), and relational database management systems (RDBMSs), especially Microsoft SQL Server 200x, is assumed. Experience with SQL Server’s Transact-SQL (T-SQL) query language and stored procedures will be helpful but is not required. Proficiency with VS 2005, .NET 2.0, C# 2.0, or VB 8.0 will aid your initial understanding of the book’s C# 3.0 or VB 9.0 code samples but isn’t a prerequisite. Microsoft’s .NET code samples are primarily written in C#. All code samples in this book’s chapters and sample projects have C# and VB versions unless they’re written in T-SQL or JavaScript. Professional ADO.NET 3.5: LINQ and the Entity Framework concentrates on programming the “Taking a New Approach to Data Access in ADO.NET 3.5,” uses simple C# and VB code examples to demonstrate LINQ to Objects queries against in-memory objects and databinding with LINQ-populated generic List “Understanding LINQ Architecture and Implementation,” begins with the namespaces and C# and VB language extensions to support LINQ, LINQ Standard Query Operators (SQOs), expression trees and compiled queries, and a preview of domain-specific implementations. C# and VB sample projects demonstrate object, array, and collection initializers, extension methods, anonymous types, predicates, lambda expressions, and simple query expressions. “Executing LINQ Query Expressions with LINQ to Objects,” classifies the 50 SQOs into operator groups: Restriction, Projection, Partitioning, Join, Concatenation, Ordering, Grouping, Set, Conversion, and Equality, and then lists their keywords in C# and VB. VS 2008 SP1 includes C# and VB versions of the LINQ Project Sample Query Explorer, but the two Explorers don’t use real-world collections as data sources. This describes a LINQ in-memory object generator (LIMOG) utility program that writes C# 3.0 or VB 9.0 class declarations for representative business objects that are more complex than those used by the LINQ Project Sample Query Explorers. Sample C# and VB queries with these business objects as data sources are more expressive than those using a arrays of a few integers or last names. “Working with Advanced Query Operators and Expressions,” introduces LINQ queries against object graphs with entities that have related (associated) entities. This begins with examples of aggregate operators, explains use of the “Using LINQ to SQL and the LinqDataSource,” introduces LINQ to SQL as Microsoft’s first O/RM tool to reach released products status and shows you how to autogenerate class files for entity types with the graphical O/R Designer or command-line “Querying DataTables with LINQ to DataSets,” begins with a comparison of “Manipulating Documents with LINQ to XML,” describes one of LINQ most powerful capabilities: managing XML Infosets. This demonstrates that LINQ to XML has query and navigation capabilities that equal or surpasses XQuery 1.0 and XPath 2.0. It also shows LINQ to XML document transformation can replace XQuery and XSLT 1.0+ in the majority of common use cases. You learn how to use VB 9.0’s XML literals to constructs XML documents, use “Exploring Third-Party and Emerging LINQ Implementations,” describes Microsoft’s Parallel LINQ (also called PLINQ) for taking advantage of multiple CPU cores in LINQ to Objects queries, LINQ to REST for translating LINQ queries into Representational State Transfer URLs that define requests to a Web service with the HTML GET, POST, PUT, and DELETE methods, and Bart De Smet’s LINQ to Active Directory and LINQ to SharePoint third-party implementations. “Raising the Level of Data Abstraction with the Entity Data Model,” starts with a guided tour of the development of EDM and EF as an O/RM tool and heir apparent to ADO.NET DataSets, provides a brief description of the entity-relationship (E-R) data model and diagrams, and then delivers a detailed analysis of EF architecture. Next comes an introduction to the Entity SQL (eSQL) language, eSQL queries, client views, and Object Services, including the “Defining Conceptual, Mapping, and Storage Schema Layers,” provides detailed insight into the structure of the System.Linq
and System.Linq.Expressions
namespaces for LINQ to Objects, System.Data.Linq
for LINQ to SQL, System.Data.Linq
for LINQ to DataSet, System.Xml.Linq
for LINQ to XML, and System.Data.Entity
and System.Web.Entity
for EF’s Entity SQL. DataTable
s with LINQ to DataSets, creating EntitySet
s with LINQ to Entities, querying and manipulating XML InfoSets with LINQ to XML, and performing queries against strongly typed XML documents with LINQ to XSD.Let
temporary local variable operator, shows you how to use Group By
with aggregate queries, conduct the equivalent of left outer joins, and take advantage of the Contains()
SQO to emulate SQL’s IN()
function. You learn how to compile queries for improved performance, and create mock object classes for testing without the overhead of queries against relational persistence stores.SqlMetal.exe
. This also explains how to edit *.dbml
mapping files in the Designer or XML Editor, instantiate DataContext
objects, and use LINQ to SQL as a Data Access Layer (DAL) with T-SQL queries or stored procedures. Closes with a tutorial for using the ASP.NET LinqDataSource control with Web sites or applications.DataSet
and DataContext
objects and features, followed by a description of the DataSetExtensions
. Next comes querying untyped and typed DataSets, creating lookup lists, and generating LinqDataView
s for databinding with the AsDataView()
method. This ends with a tutorial that shows you how to copy LINQ query results to DataTable
s.GroupJoin()
to produce hierarchical documents, and work with XML namespaces in C# and VB.ObjectContext
, MetadataWorkspace
, and ObjectStateManager
. Later chapters describe eSQL and these objects in greater detail. Two C# and VB sample projects expand on the eSQL query and Object Services sample code.*.edmx
file that generates the *.ssdl
(storage schema data language), *.msl
(mapping schema language), and *.csdl
files at runtime. You learn how to edit the *.edmx file manually to accommodate modifications that the graphic EDM Designer can’t handle. You learn how to implement the Table-per-Hierarchy (TPH) inheritance model and traverse the MetadataWorkspace to obtain property values. Four C# and VB sample projects de...
商品描述(中文翻譯)
語言整合查詢 (Language Integrated Query, LINQ) 以及 C# 3.0 和 VB 9.0 的語言擴展以支援 LINQ,是 Visual Studio 2008 和 .NET Framework 3.x 中最重要的單一新特性。LINQ 是微軟首次嘗試為各種內存中的通用物件集合、持久化於關聯資料庫表中的實體、XML 文件或片段的元素和屬性,以及各種其他數據類型(如 RSS 和 Atom 聚合源)定義一種通用查詢語言。微軟在 Anders Hejlsberg 和他的 C# 設計與開發團隊上投資了數百萬美元,以新增 C# 3.0 的新特性,例如 lambda 表達式、匿名類型和擴展方法,專門用來支援 LINQ 標準查詢運算子 (Standard Query Operators, SQOs) 和查詢表達式作為語言的一部分。
對 VB 9.0 的相應新增功能跟隨 C# 團隊的步伐,但 VB 的 LINQ to XML 實現提供了一個顯著的新特性:XML 字面量。VB 的 LINQ to XML 實現包括 XML 字面量,這使得格式正確的 XML 文件或片段成為 VB 語言的一部分,而不需要將元素和屬性名稱及值從字串轉換為 XML DOM 節點和值。
本書專注於實作 Windows 和 Web 應用程式的開發,展示 C# 和 VB 編程技術,以幫助您快速掌握 LINQ 技術。本書的前半部分涵蓋 LINQ 標準查詢運算子 (SQOs) 以及 LINQ 的具體實現,用於查詢實現了通用 IEnumerable、IQueryable 或兩者接口的集合。後半部分專注於 ADO.NET 實體框架 (Entity Framework)、實體數據模型 (Entity Data Model)、實體 SQL (Entity SQL, eSQL) 和 LINQ to Entities。大多數代碼示例模擬真實世界的數據來源,例如運行在 SQL Server 2005 或 2008 Express Edition 上的 Northwind 範例數據庫及其表中衍生的集合。代碼示例為 C# 和 VB 的 Windows 表單或網站/應用程式專案,除了第一章外,並非簡單的命令行專案。您無法通過處理幾個整數或幾個名字的「Hello World」專案來感受 LINQ 查詢的行為或性能。
本書適合有經驗的 .NET 開發人員使用 C# 或 VB,想要充分利用 Visual Studio 2008 中 LINQ 實現的查詢處理能力——包括 LINQ to Objects、LINQ to SQL、LINQ to DataSets 和 LINQ to XML——以及 VS 2008 SP1 的實體框架/實體數據模型和 LINQ to Entities 的物件/關聯映射 (O/RM) 特性,以及越來越多的第三方開源 LINQ 實現。
假設讀者對 .NET 2.0 引入的泛型和其他語言特性、Visual Studio 整合開發環境 (IDE) 和關聯資料庫管理系統 (RDBMS),特別是微軟 SQL Server 200x 有基本的熟悉程度。對 SQL Server 的 Transact-SQL (T-SQL) 查詢語言和存儲過程的經驗將有幫助,但不是必需的。熟悉 VS 2005、.NET 2.0、C# 2.0 或 VB 8.0 將有助於您最初理解本書的 C# 3.0 或 VB 9.0 代碼示例,但不是前提條件。
微軟的 .NET 代碼示例主要用 C# 編寫。本書各章和示例專案中的所有代碼示例都有 C# 和 VB 版本,除非它們是用 T-SQL 或 JavaScript 編寫的。
《專業 ADO.NET 3.5:LINQ 和實體框架》專注於編程 System.Linq
和 System.Linq.Expressions
命名空間以實現 LINQ to Objects,System.Data.Linq
用於 LINQ to SQL,System.Data.Linq
用於 LINQ to DataSet,System.Xml.Linq
用於 LINQ to XML,以及 System.Data.Entity
和 System.Web.Entity
用於 EF 的實體 SQL。
- “在 ADO.NET 3.5 中採取新方法進行數據訪問”使用簡單的 C# 和 VB 代碼示例來演示對內存對象的 LINQ to Objects 查詢,以及使用 LINQ 填充的通用 List 集合進行數據綁定,使用 LINQ to SQL 進行物件/關聯映射 (O/RM),使用 LINQ to DataSets 連接 DataTable
,使用 LINQ to Entities 創建 EntitySet
,使用 LINQ to XML 查詢和操作 XML InfoSets,以及使用 LINQ to XSD 對強類型 XML 文件進行查詢。
- “理解 LINQ 架構和實現”從命名空間和 C# 和 VB 語言擴展以支援 LINQ 開始,LINQ 標準查詢運算子 (SQOs)、表達式樹和編譯查詢,以及特定領域實現的預覽。C# 和 VB 示例專案演示物件、數組和集合初始化器、擴展方法、匿名類型、謂詞、lambda 表達式和簡單查詢表達式。
- “使用 LINQ to Objects 執行 LINQ 查詢表達式”將 50 個 SQOs 分類為運算子組:限制、投影、分區、連接、串接、排序、分組、集合、轉換和相等,然後列出它們在 C# 和 VB 中的關鍵字。VS 2008 SP1 包含 LINQ 專案示例查詢瀏覽器的 C# 和 VB 版本,但這兩個瀏覽器不使用真實世界的集合作為數據來源。這描述了一個 LINQ 內存對象生成器 (LIMOG) 實用程序,該程序為代表性業務對象寫入 C# 3.0 或 VB 9.0 類聲明,這些對象比 LINQ 專案示例查詢瀏覽器使用的對象更為複雜。使用這些業務對象作為數據來源的 C# 和 VB 查詢比使用幾個整數或姓氏的查詢更具表達性。
- “使用高級查詢運算子和表達式”介紹對具有相關(關聯)實體的對象圖進行 LINQ 查詢。這從聚合運算子的示例開始,解釋如何使用 Let
臨時局部變量運算子,展示如何使用 Group By
進行聚合查詢,進行左外連接的等效操作,並利用 Contains()
SQO 模擬 SQL 的 IN()
函數。您將學習如何編譯查詢以提高性能,並創建模擬對象類以進行測試,而無需對關聯持久性存儲進行查詢的開銷。
- “使用 LINQ to SQL 和 LinqDataSource”介紹 LINQ to SQL 作為微軟首個達到正式產品狀態的 O/RM 工具,並展示如何使用圖形 O/R 設計器或命令行 SqlMetal.exe
自動生成實體類型的類文件。這還解釋了如何在設計器或 XML 編輯器中編輯 *.dbml
映射文件,實例化 DataContext
對象,並使用 LINQ to SQL 作為數據訪問層 (DAL) 與 T-SQL 查詢或存儲過程。最後提供了使用 ASP.NET LinqDataSource 控制項與網站或應用程式的教程。
- “使用 LINQ to DataSets 查詢 DataTables”從比較 DataSet
和 DataContext
對象及其特性開始,接著描述 DataSetExtensions
。接下來是查詢未類型和類型的 DataSets,創建查找列表,並生成 LinqDataView
以使用 AsDataView()
方法進行數據綁定。最後提供了一個教程,展示如何將 LINQ 查詢結果複製到 DataTable
中。
- “使用 LINQ to XML 操作文檔”描述了 LINQ 最強大的能力之一:管理 XML InfoSets。這表明 LINQ to XML 具有等同於或超過 XQuery 1.0 和 XPath 2.0 的查詢和導航能力。它還顯示 LINQ to XML 文檔轉換可以在大多數常見用例中取代 XQuery 和 XSLT 1.0+。您將學習如何使用 VB 9.0 的 XML 字面量構建 XML 文檔,使用 GroupJoin()
生成層次結構文檔,並在 C# 和 VB 中處理 XML 命名空間。
- “探索第三方和新興的 LINQ 實現”描述了微軟的平行 LINQ(也稱為 PLINQ),以利用多個 CPU 核心進行 LINQ to Objects 查詢,LINQ to REST 將 LINQ 查詢轉換為表示性狀態轉移 URL,這些 URL 定義了對 Web 服務的請求,使用 HTML 的 GET、POST、PUT 和 DELETE 方法,以及 Bart De Smet 的 LINQ to Active Directory 和 LINQ to SharePoint 第三方實現。
- “提高數據抽象層次與實體數據模型”從 EDM 和 EF 作為 O/RM 工具的發展導覽開始,提供實體關係 (E-R) 數據模型和圖的簡要描述,然後對 EF 架構進行詳細分析。接下來介紹實體 SQL (eSQL) 語言、eSQL 查詢、客戶端視圖和物件服務,包括 ObjectContext
、MetadataWorkspace
和 ObjectStateManager
。後面的章節將更詳細地描述 eSQL 和這些對象。兩個 C# 和 VB 示例專案擴展了 eSQL 查詢和物件服務的示例代碼。
- “定義概念、映射和存儲架構層”提供了對生成 *.ssdl
(存儲架構數據語言)、*.msl
(映射架構語言)和 *.csdl
文件的 *.edmx
文件結構的詳細見解。您將學習如何手動編輯 *.edmx 文件,以適應圖形 EDM 設計器無法處理的修改。您將學習如何實現每個層次的表 (Table-per-Hierarchy, TPH) 繼承模型,並遍歷 MetadataWorkspace 以獲取屬性值。四個 C# 和 VB 示例專案...