TAILIEUCHUNG - Microsoft SQL Server 2008 R2 Unleashed- P185

Microsoft SQL Server 2008 R2 Unleashed- P185:SQL Server 2005 provided a number of significant new features and enhancements over what was available in SQL Server 2000. This is not too surprising considering there was a five-year gap between these major SQL Server 2008 is not as much of a quantum leap forward from SQL Server 2005 | 1794 CHAPTER 45 SQL Server and the .NET Framework FIGURE Adding a LINQ to SQL classes file to your Windows Forms sample application. After your new .dbml file is created in your project Visual Studio s Object Relational O R Designer opens up with its blank surface ready. On this surface you add C data classes that mirror the tables and relationships in your database. This is the heart of what is known as object relational mapping ORM each class represents a database table. Each instance of that class represents a row in that table. Each property on each instance represents either a column and its value or a collection of related via ORM objects. Changes to these object instances including updates insertions and deletions once committed are reflected as changes to the underlying rows in your tables. LINQ to SQL operates on these ORM objects which are defined in the code of your .dbml file. Using Visual Studio s View menu open Server Explorer. Right-click its root node and select Add Connection. Fill out the form to set up a connection to your AdventureWorks2008 database. When done navigate to that new node in Server Explorer it is named ServerName InstanceName .AdventureWorks2008. SchemaName . This new node should have a tiny image of a plug on its icon. Expand this node and then expand the Tables node to view the tables in your database. Shift-click the following table nodes in Server Explorer and then drag them all to your O R Designer surface and release the mouse button answer Yes to the ensuing warning dialog Product Production ProductModel Production ProductInventory Production ProductReview Production Your O R Designer surface should now look something like the one in Figure . The best way to introduce any new technology is with sample code so let s jump right in and write a LINQ to SQL query. Developing with LINQ to SQL 1795 FIGURE Viewing Visual Studio s O R Designer surface for the Windows Forms sample application. 45 Right-click your Windows

TỪ KHÓA LIÊN QUAN
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.