Transcript of "Sql server 2008 r2 and microsoft data platform development"
Microsoft SQL Server 2008 R2 and Microsoft Data Platform Development<br />White Paper<br />Published: August 2007<br />Summary: Microsoft SQL Server 2008 R2 and the Microsoft data platform provide developers with a comprehensive programming framework in which to create data centric solutions that target mobile devices, desktops, Web servers, and enterprise servers. This data programming environment improves developer productivity by integrating data access and management into the business logic of an application. It provides a comprehensive platform for data access and management from disparate data sources and a scalable solution for data storage and applications.<br />Contents<br /> TOC o "1-2" Introduction PAGEREF _Toc205575721 h 1<br />Improved Productivity PAGEREF _Toc205575722 h 1<br />ADO.NET Entity Framework PAGEREF _Toc205575723 h 1<br />LINQ PAGEREF _Toc205575724 h 3<br />Visual Studio PAGEREF _Toc205575725 h 3<br />Comprehensive Data Platform PAGEREF _Toc205575726 h 4<br />Data Connectivity Technologies PAGEREF _Toc205575727 h 4<br />Rich Data Programmability Capabilities PAGEREF _Toc205575728 h 5<br />Your Data, Any Place, Any Time PAGEREF _Toc205575729 h 6<br />Scalable Data-Centric Solutions PAGEREF _Toc205575730 h 6<br />Scalable Data Storage PAGEREF _Toc205575731 h 6<br />Scalable Applications PAGEREF _Toc205575732 h 7<br />Conclusion PAGEREF _Toc205575733 h 8<br />Introduction<br />As database systems and programming languages have evolved over the years they have each concentrated on their specific functionality and drifted apart in terms of communication between the two. This has resulted in an impedance mismatch between the data storage and business logic in today’s applications. SQL Server 2008 R2 in conjunction with the Microsoft Data Platform technologies enables you to quickly and easily build comprehensive and scalable data-centric solutions that bridge the mismatch.<br />Specifically, the ADO.NET Entity Framework defines a new way for developers to conceptualize data into easy-to-use entities and a revolutionary technology called LINQ defines a new and powerful data access query syntax to communicate directly with virtually any type of data, including entities and SQL Server 2008 R2.<br />SQL Server 2008 R2 focuses on three key areas to meet today’s data programmability needs:<br />Productivity. SQL Server 2008 R2 and Microsoft Visual Studio® enable developers to be more productive through the use of new data models, syntax, and team tools.<br />Connectivity. SQL Server 2008 R2 supports new and legacy data connectivity technologies, which enables developers to work with the most appropriate technology for their requirements.<br />Scalability. SQL Server 2008 R2 provides a scalable database system for many different types of workloads, from mobile devices to enterprise solutions. It also integrates with Visual Studio, and so enables developers to build scalable solutions.<br />Improved Productivity<br />Microsoft SQL Server 2008 R2 and development technologies from the Microsoft Data Platform improve developer productivity by providing seamless integration between frameworks, data connectivity technologies, programming languages, Web services, development tools, and data.<br />ADO.NET Entity Framework<br />Developers often spend countless hours deciphering database schemas and writing complex queries to retrieve the data that they need in their applications. The ADO.NET Entity Framework simplifies these tasks and enables developers to focus on the business logic of their applications.<br />Enterprise systems often use data from multiple disparate sources that use different schemas and naming conventions. In addition, these data sources often use varying levels of normalization, which results in information for a particular business item being spread across multiple tables and rows. This results in developers needing to write a large amount of application logic to manage these complex database relations.<br />The ADO.NET Entity Framework, which is based on the Entity Data Model, enables developers to transform the relational data in database schemas into conceptual entities that can be used directly in applications. For example, the customer data in your application may be stored across multiple tables in a database. By using the ADO.NET Entity Framework, architects and developers can define a single conceptual customer entity that neatly abstracts the complex relations that are required to access and update customer data from an application. This layer of abstraction isolates the data access logic into a set of well defined entities that can be used in an application and the abstraction helps developers to concentrate on developing the application logic.<br />The ADO.NET Entity Framework provides a data programming interface that makes it:<br />Easy to understand the conceptual data model. By using the Entity Data Model, you can work with data in terms of the business logic in your application, as opposed to the logical schema in the data source.<br />Easy to design and develop applications. By developing applications that align business logic with data access logic it is significantly easier for architects to design applications and for developers to write code.<br />Easy to maintain applications. By using a conceptual data model, developers can concentrate on the business logic in an application, as opposed to the data storage logic. Furthermore, the ADO.NET Entity Framework shields applications from changes to the underlying data schema, so minimizes the maintenance effort.<br />Because the Entity Data Model uses entities as opposed to tables and rows, developers need a query language that interacts with those objects. Entity SQL is a new language that enables the execution of set-oriented declarative queries and updates for the entities and relationships in the Entity Data Model. Entity SQL is virtually data provider agnostic, so you can reuse queries against different database providers, which saves you coding time.<br />Most developers use object oriented programming languages such as C# and Visual Basic for writing new code in their business applications. These languages model entities as classes and their behaviors as code, in contrast to ADO.NET which exposes data as values. This introduces an impedance mismatch between the data and the application. The ADO.NET Entity Framework provides an object services layer that reduces this mismatch. Developers can use Object Services to build typed queries and to return, manipulate, and update results as business objects. The ADO.NET Entity Framework generates .NET classes from the Entity Data Model entities in a schema. These classes are partial classes so developers can extend them with custom business logic without affecting the generated code. These business objects can be queried by using Entity SQL or Language Integrated Query (LINQ).<br />LINQ<br />Today’s data access code is embedded in string literals in an application and written in a database-specific SQL dialect. Because of this, developers must be conversant in a SQL dialect as well as their chosen programming language. This raises the knowledge requirements for data-centric solution developers. Embedding queries in string literals means that the code cannot be type-checked at compile time and so developers must wait until the query code is sent to the database server to determine success. This runtime debugging often results in a more complex debugging process.<br />LINQ is a set of extensions to the Microsoft .NET Framework libraries and to C# and Visual Basic .NET that enables these languages to treat data as a firstclass object. LINQ enables developers to write queries in their native programming language, which can then be type and syntax checked at compile time. Because it is an integral part of the .NET language, LINQ can also take advantage of Microsoft IntelliSense in the Microsoft Visual Studio development system.<br />LINQ can be used against a variety of data sources including in-memory data structures, XML documents, databases, entity models, and data sets. For example, LINQ can be used to access data from three different sources, manipulate the data, and then output it to a fourth data store. This functionality greatly simplifies working with data from disparate sources. <br />There are five implementations of LINQ that enable you to access data:<br />LINQ to SQL supports rapid development of applications that query all editions of Microsoft SQL Server by using programmatic objects that map directly to database objects in SQL Server schemas, for example, tables, views, stored procedures, and user defined functions.<br />LINQ to Entities supports a more flexible mapping of objects to relational tables, views, stored procedures, and user defined functions. You can use LINQ to Entities to access data from SQL Server and other relational databases through extended ADO.NET data providers.<br />LINQ to DataSet introduces rich query capabilities on top of both regular and typed DataSets. This enables you to create and query joins between DataTables in a DataSet.<br />LINQ to XML is an in-memory XML programming application programming interface (API) that is designed to take advantage of the latest .NET Framework language innovations.<br />LINQ to Object empowers you to run LINQ queries against in-memory objects. This enables you to use in-memory data in the same way that you use data from any other source.<br />Visual Studio<br />Visual Studio combines all of these data platform technologies into a powerful, yet highly productive and easy-to-use environment. Visual Studio is a comprehensive development environment that enables architects and developers to easily design and develop both client and server code.<br />Visual Studio provides developers with tools that can automatically create entities for existing and new data sources. Partial classes can be generated that take advantage of the new object services layer. After the Entity Data Model has been generated, developers can use Entity SQL and LINQ to program against it in a new and productive manner.<br />Visual Studio provides developers with IntelliSense information as they write code. Because the ADO.NET Entity Framework and LINQ are fully integrated into C# and Visual Basic .NET, developers can use the powerful IntelliSense feature when using these features to build applications. This results in a more productive development environment for designing and developing database applications, higher quality code and a system that is easier to maintain.<br />Visual Studio Team System helps you to improve the efficiency of your entire development process by providing features such as source code control, tracking, and deployment tools that the whole team can use, from Project Managers through to Testers.<br />Comprehensive Data Platform<br />SQL Server 2008 R2 works in conjunction with current and new data access technologies to provide developers with a comprehensive data platform on which to build data-centric solutions that access, consume, and manage data from any data source and streamline its delivery to relevant users.<br />Data Connectivity Technologies<br />Microsoft provides developers with a wide range of data connectivity technologies to enable them to access and manage data from disparate sources.<br />Native data access technologies, such as ODBC drivers and ADO/OLEDB, provide developers with access to a wide range of databases and data source. ODBC remains the most commonly used data access technology and supports access from Visual Studio solutions to SQL Server 2008 R2. ADO and OLEDB enable developers to connect to databases and other data sources, including SQL Server 2008 R2.<br />Microsoft also supports a set of managed data access technologies, including the ADO.NET Entity Framework, the ADO.NET data providers, and the .NET Framework LINQ. The ADO.NET Entity Framework enables developers to work with data at the conceptual level, eliminating the impedance mismatch between the logical database schema and the business logic in applications. The ADO.NET data providers enable developers to access any type of data from any type of data source in a wide range of applications, from traditional client server to applications running on compact devices. LINQ enables developers to query and manage all types of data by using their native programming language.<br />The Microsoft data platform also enables developers to access non-Microsoft data by using technologies such as XML, JDBC drivers, and PHP drivers.<br />Rich Data Programmability Capabilities<br />The rich set of data platform technologies available in the new versions of SQL Server and ADO.NET enable developers to build the next generation of data-centric solutions that meet the most demanding requirements. These technologies also reduce the overall complexity of designing, developing, and maintaining data-centric solutions.<br />LINQ provides extensions to Visual Basic and C# that enable developers to query data natively from these languages. This provides a consistent syntax for both data access and business logic code in applications. When using LINQ, compared to embedding SQL code inside business logic, developers benefit from faster query processing, design time error checking and type checking, and IntelliSense support for data access code in the development environment.<br />Traditionally, developers have accessed data by referencing the tables and columns in which that data is stored. This means that developers need to be familiar with the database structure and fully aware that any changes to that structure dramatically affect an application. The ADO.NET Entity Framework enables developers to work with data at the conceptual level by using entities and relationships, which removes the need for developers to be aware of the underlying database storage structure, and thus isolates the data access logic in an application. It also simplifies solution development and maintenance because developers can work with business entities that mirror the entities in their application domain.<br />Business applications often require complex procedural operations to occur at the database level. Transact-SQL is designed for working with relational data and set-based operations, but not procedural programming, so developers often extract data, work with it in the business logic or data access layer, and then save the data back to the database. This results in passing excessive amounts of data between layers, potentially across the network, and can affect the application performance. Alternatively, developers write extended stored procedures and functions and use COM interoperability to work with them. However, neither of these solutions is ideal because of the complexity involved in writing such code. Since the release of SQL Server 2005, the SQL Server Database Engine has hosted the .NET Framework Common Language Runtime (CLR).This enables developers to write stored procedures and userdefined functions in managed code, by using languages such as Visual Basic and C#. <br />Your Data, Any Place, Any Time<br />The Microsoft data platform enables developers to create data-centric solutions that access data from any place, and at any time, and supports a wide range of native and managed connectivity technologies, programming languages, programming frameworks and Web services.<br />Through the support of multiple programming languages, the data platform enables developers to use the most appropriate language for their needs without restricting the data source or tasks that developers can work with.<br />However, some applications cannot have a permanent connection to the data source that they use. The data platform supports this scenario by providing SQL Server Compact Edition and Microsoft Synchronization Services to support occasionally connected solutions.<br />Scalable Data-Centric Solutions<br />SQL Server 2008 R2 provides the functionality that developers need to build scalable data-centric solutions that target any workload, from the smallest device to the largest servers, and enables applications to grow alongside business needs.<br />Scalable Data Storage<br />SQL Server is a highly scalable database server that is available in several editions, each designed to meet the requirements of a specific workload. For example, an edition is available for mobile, desktop, workgroup, departmental, and enterprise applications. Each edition provides robust data management that grows with the needs of your applications and data storage requirements. SQL Server 2008 R2 includes a rich set of data platform features that improve the scalability of applications to meet your business needs.<br />By using the .NET Framework CLR inside SQL Server, developers can easily write stored procedures and user defined functions using highly maintainable managed code. This improves scalability because managed code is more efficient and runs directly against the data in the database.<br />SQL Server 2008 R2 supports a wide variety of data types that help applications to scale effectively. The GEOMETRY and GEOGRAPHIC data types enable developers to directly work with geospatial data. The new FILESTREAM feature enables database applications to store BLOB data in its native format on the file system outside of the database, while maintaining a seamless link to the database. This allows users to access the data as if it was stored in the database, but ensures that the database size remains manageable.<br />SQL Server provides developers with robust streaming APIs that enable them to efficiently process large amounts of data. SQL Server 2008 R2 and LINQ provide streaming with LINQ to XML that enables developers to output large amounts of XML data in a simple manner.<br />Scalable Applications<br />Each SQL Server edition contains functionality that provides the data management requirements for applications targeted to that edition. Developers can build applications that target any scale of use and, if required, easily scale the design and code to upgrade to a more powerful edition of SQL Servers. An application may be built against one database schema, then later require schema changes. Before the Entity Framework, this situation would have required many updates to the application code to support such changes. With the Entity Framework, applications are shielded from such changes and updates can be made easily.<br />Furthermore, developers might build a project by using LINQ to SQL and then find that due to requirement changes, they need more flexible mapping or access to other databases. Microsoft will provide tools and guidance to these customers to migrate their applications to LINQ to Entities.<br />Service Broker is a highly reliable messaging and queuing technology that provides an asynchronous programming model for database applications. It supports high-speed messaging within a single SQL Server instance and across multiple instances on multiple servers. It enables applications to send and receive asynchronous messages by using Transact-SQL that is guaranteed, on time, in order, and secure. This enables developers to build secure database applications that can easily scale to use services on other instances of SQL Server.<br />SQL Server Compact Edition is a low maintenance small footprint embedded database engine that enables developers to build database applications for desktop and mobile devices. When using SQL Server Compact edition in conjunction with Microsoft Sync Services, developers can build next generation occasionally connected solutions (OCS). This enables mobile users to work with their local copy of the database and synchronize with a central server when they are connected. Distributing workloads between client devices and the database server can drastically increase the scalability of your solutions.<br />Visual Studio Team System provides a development platform for all members of an enterprise solution team. In conjunction with SQL Server 2008 R2, developers can easily expose objects, data sources, and business intelligence components through HTTP. This enables a broader range of clients to access SQL Server data from heterogeneous environments by using standard protocols and increases the accessibility and reuse of business intelligence components, such as reports and cubes, through Web services.<br />Conclusion<br />SQL Server 2008 R2 is a comprehensive data platform for building robust, scalable data-centric solutions for mobile devices, desktops, workgroups and the enterprise. In conjunction with the latest version of the .NET Framework and ADO.NET, developers can become more productive and write better, more efficient and more maintainable source code. LINQ to SQL enables developers to write data access code in native programming languages and take advantage of the integral syntax checking and IntelliSense capabilities in Visual Studio. SQL Server 2008 R2 supports the use of many data connectivity technologies and provides a rich set of programming capabilities, such as Service Broker and the .NET Framework CLR. It also supports applications for targeting all types of devices. Finally, SQL Server 2008 R2 is scalable in terms of both data storage and application requirements.<br />For more information:<br />General product information: http://www.microsoft.com/sql/<br />For developers: http://msdn2.microsoft.com/sqlserver<br />For IT Pros and administrators: http://technet.microsoft.com/sqlserver <br />Please give us your feedback:<br />Did this paper help you? Tell us on a scale of 1 (poor) to 5 (excellent), how would you rate this paper and why have you given it this rating? For example:<br />Are you giving it a high rating because it has good examples, excellent screenshots, clear writing, or another reason? <br />Are you giving it a low rating because it has poor examples, fuzzy screenshots, unclear writing?<br />This feedback will help us improve the quality of white papers we release. Send feedback.<br />