|
Objectify Data With ADO.NET vNext
The ADO.NET vNext August 2006 Community Technical Preview reincarnates ObjectSpaces’ object/relational mapping technology and OPath query language as the Entity Framework, Entity Data Model, Entity SQL, and LINQ to Entities for the Visual Studio “Orcas” release.
by Roger Jennings
October 30, 2006
Technology Toolbox: VB.NET, C#, SQL Server 2005, XML
Other: Visual Studio 2005, or Visual Basic or Visual C# Express editions, Microsoft Visual Studio Code Name “Orcas” Language-Integrated Query, May 2006 Community Technology Preview, ADO.NET vNext August 2006 Community Technical Preview, SQL Server 2005 Express Edition or higher (see Additional Resources).
The data-management landscape will undergo a sea change for .NET developers when ADO.NET vNext releases in 2007 with the .NET Framework 3.0 and Visual Studio vNext, code-named “Orcas.”
Among the most significant aspects of this change: ADO.NET vNext will include an object/relational mapping (O/RM) tool, called the ADO.NET Entity Framework (EF). EF’s primary goal, like that of all other O/RM tools, is to reduce the disconnect—often called an impedance mismatch—between relational and object models. EF incorporates the Entity Data Model (EDM), the Entity SQL (eSQL) query language, and LINQ for Entities extensions to VB 9.0 and C# 3.0. EDM is a traditional entity-relationship (ER) data model that defines Entities as instances of EntityTypes (Customer, for example) and EntitySets as keyed collections of Entities (Customer). An EntityKey (CustomerID) uniquely identifies an Entity for viewing and updating. The Entity Key enables Entities to participate in Relationships, which are instances of RelationshipTypes that define Associations between EntityTypes; Relationships are members of RelationshipSets.
EF offers VS developers a mapped, data-access component replacement for the Enterprise Libfrary’s Data Access Application Block and an object persistence alternative to DataSets. EF automates generating an updatable client-side view of business entities from a relational data source.
According to Microsoft Research’s Sergey Melnik, “Up to 40% of the code in enterprise systems” is devoted to solving object/relational impedance mismatches. That’s why having a robust, cost-effective and performant O/RM solution is so important to .NET developers. In the words of Microsoft Research’s Dr. Jim Gray, another O/RM objective is to minimize the programming effort required to “ask a question and obtain a collection” (see Additional Resources).
I’ll walk you through EF’s basic components and programming techniques, as well as show you how EF and LINQ for Entities differ from the earlier SQL Server-oriented DLink (now called LINQ for SQL). Before diving into the specifics of how to use EF, it’s important to understand the problem space fueling the creation of this technology. Object-oriented programming became the norm for most Windows developers during the late 1990s, but there’s been no similar revolution in database technology. Object databases failed to gain significant market share or developer mindshare, but most .NET and, virtually all Java, application programmers have come to consider relational databases to be stores for persisting business objects. (DBAs, of course, would argue this classification.)
Efficiently moving complex business objects to and from row-column relational data isn’t easy, as Microsoft discovered when attempting to productize their first O/RM add-in for VS called ObjectSpaces. ObjectSpaces first appeared as a technical preview named “Orca” at Microsoft’s 2001 Professional Development Conference (PDC). The Visual Studio team added ObjectSpaces to VS 2005 Beta 1, dropped it from Beta 2, and postponed it to WinFS at TechEd 2005, before finally imposing the death sentence on ObjectSpaces when WinFS bit the dust on June 23, 2006. Over that five-year time span, the .NET-specific O/RM market grew from a few to at least 36 open-source and proprietary products as of mid-2006 (see Additional Resources.) At this time, Microsoft didn’t even offer a CTP of a general-purpose OR/M tool to support domain-model programming advocates and complement its LINQ technology for integrating query linguistics into C# 3.0 and VB 9.0.
Back to top
|