1. Trang chủ
  2. » Công Nghệ Thông Tin

Tài liệu Module 8: The Nontransactional Data Access Layer doc

62 362 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 62
Dung lượng 901,03 KB

Nội dung

Contents Overview 1 Introduction to the Data Access Layer 2 Nontransactional DAL Technologies 5 Demonstration: ADSI 22 Logical Design of Nontransactional DAL 24 Physical Design of Nontransactional DAL 28 Market Purchasing 46 Best Practices 49 Lab 8: Nontransactional DAL 50 Review 54 Module 8: The Nontransactional Data Access Layer Information in this document is subject to change without notice. The names of companies, products, people, characters, and/or data mentioned herein are fictitious and are in no way intended to represent any real individual, company, product, or event, unless otherwise noted. Complying with all applicable copyright laws is the responsibility of the user. No part of this document may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without the express written permission of Microsoft Corporation. If, however, your only means of access is electronic, permission to print one copy is hereby granted. Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property.  2000 Microsoft Corporation. All rights reserved. Microsoft, Active Directory, ActiveX, BackOffice, BizTalk, FrontPage, Microsoft Press, MSDN, MS-DOS, PowerPoint, Visio, Visual Basic, Visual C++, Visual InterDev, Visual J++, Visual Studio, Win32, Windows, and Windows NT are either registered trademarks or trademarks of Microsoft Corporation in the U.S.A. and/or other countries. Other product and company names mentioned herein may be the trademarks of their respective owners. Program Managers: Rhy Mednick, Susie Parrent Instructional Designer: Susie Parrent Subject Matter Experts: David Chesnut, Sam Gill (TechnoWiz), Michel Pahud Media Management: David Mahlmann Editing Manager: Lynette Skinner Editor: Mick Alberts, Jennifer Linn Production Manager: Miracle Davis Print Coordinators: Linda Lu Cannon (Write Stuff), Marlene Lambert (Online Training Solutions, Inc.) Build Coordinator: Eric Wagoner Graphic Artist: Scott Serna Test Lead: Eric Myers Manufacturing Manager: John Williams Group Product Manager: Juan Fernando Rivera Lead Product Manager, System Services and Infrastructure: Edward Dudenhoefer Manufacturing Manager: Rick Terek Operations Coordinator: John Williams Manufacturing Support: Laura King; Kathy Hershey Lead Product Manager, Release Management: Bo Galford Group Manager, Courseware Infrastructure: David Bramble General Manager: Robert Stewart Module 8: The Nontransactional Data Access Layer iii Instructor Notes This module provides students with a presentation on the nontransactional data access layer (DAL). Module 8 is the first of two modules that focus on the DAL: Module 8, “The Nontransactional Data Access Layer” and Module 9, “The Transactional Data Access Layer.” The DAL is an application’s means of access to data services. After completing this module, students will be able to: ! Describe the differences between the two types of DALs: transactional and nontransactional. ! Describe the logical and physical designs of a nontransactional DAL and how to apply behavioral design patterns. ! Describe the data access technologies provided by Microsoft ® Data Access Connectivity (MDAC). ! Describe the cursor engine and how to create the physical design for data caching by using the cursor engine. ! Implement the logical and physical designs for a nontransactional DAL object. Materials and Preparation This section provides the materials and preparation tasks that you need to teach this module. Required Materials To teach this module, you need the following materials: ! Microsoft PowerPoint ® file 1910A_08.ppt ! Module 8: The Nontransactional Data Access Layer ! Lab 8: The Nontransactional DAL Preparation Tasks To prepare for this module, you should: ! Read all of the materials for this module. ! Complete the lab. Presentation: 75 Minutes Lab: 30 Minutes iv Module 8: The Nontransactional Data Access Layer Demonstration This section provides demonstration procedures that will not fit in the margin notes or are not appropriate for the student notes. ADSI ! To prepare for the demonstration • Review the instructions in the student notes. Module 8: The Nontransactional Data Access Layer v Module Strategy Use the following strategy to present this module: ! Introduction to the Data Access Layer The purpose of this section is to introduce students to the DAL and its main purpose, which is to buffer all other layers from the data services layer. The section also emphasizes the need to split the DAL into nontransactional and transactional layers to define the proper boundaries for COM+ applications and their attributes. In the topic “Splitting the DAL,” emphasize that the key functions for the nontransactional DAL are to receive requests from the business or Web services facade layer or business logic layer, to process the requests and pass the requests to data services, to retrieve the results from data services, and to pass the results of the processing back to the facade layer or business logic layer. ! Nontransactional DAL TechnologiesThe purpose of this section is to introduce students to the technologies that can be used in the physical design of the DAL. This is a long list of technologies that can be used by both nontransactional and transactional DALs. In the topic “Microsoft Data Access Components (MDAC)” emphasize the history of MDAC and how the Microsoft Universal Data Access (UDA) strategy has evolved over the past decade. In the topic “ADO,” emphasize that ActiveX ® Data Objects (ADO) have replaced Data Access Objects (DAO) and Remote Data Objects (RDO) as the standard for writing data-aware applications. In the topic “Cursor Service,” emphasize that this is a service provided by OLE DB and that the Cursor Service can be installed on each tier of a multitier application to provide an effective solution for scalability. In the topic “Active Directory Service Interfaces (ADSI),” emphasize that this is recommended as the primary mechanism for creating and changing objects and schemas within the Active Directory ™ services. ! Logical Design of Nontransactional DALThe purpose of this section is to identify the two design patterns that might be useful in the logical design of nontransactional DAL: Iterator and Composite. ! Physical Design of Nontransactional DALThe purpose of this section is to show how DAL technologies can be applied to the nontransactional DAL. ! Market Purchasing The purpose of this section is to discuss the logical and physical designs of nontransactional DAL in Market Purchasing and to explain the justification for the choices made. The logical design incorporates an Iterator while the physical design uses cursors and ADO for database access. vi Module 8: The Nontransactional Data Access Layer By using Component Services, you can present the Market Purchasing DAL COM+ application. Explain that both the nontransactional and transactional DAL components are registered in the same COM+ application because all of the data is physically on one computer. You may also consider presenting the source code of one of the nontransactional DAL components. Don’t show the source code of the mpdalnt.Requestor class, since that will give away the answers to the lab. ! Best Practices The best practices focus on using an Iterator as a design pattern for a class rather than having a separate collection class for each business entity. The physical design best practices focus on the efficient use of cursors: client vs. server side. Lab Strategy ! Lab 8: The Nontransactional DAL The purpose of Lab 8 is for students to learn how to design the nontransactional DAL. Students probably will not derive answers that correspond exactly to the Market Purchasing design. This is acceptable as long as the student answers are justified and reflect the principles discussed in the module. Discuss with students their answers to Lab 8. Module 8: The Nontransactional Data Access Layer 1 # ## # Overview ! Introduction to the Data Access Layer ! Nontransactional DAL Technologies ! Logical Design of Nontransactional DAL ! Physical Design of Nontransactional DAL ! Market Purchasing ! Best Practices Module 8 is the first of two modules that focus on the data access layer (DAL): Module 8, “The Nontransactional Data Access Layer” and Module 9, “The Transactional Data Access Layer.” The DAL is an application's access to data services. After completing this module, you will be able to: ! Describe the differences between the two types of DALs: transactional and nontransactional. ! Describe the logical and physical designs of a nontransactional DAL and how to use behavioral design patterns. ! Describe the data access technologies provided by Microsoft ® Data Access Connectivity (MDAC). ! Describe the cursor engine and how to create the physical design for data caching using the cursor engine. ! Implement the logical and physical designs for a nontransactional DAL object. Topic Objective To provide an overview of the module topics and objectives. Lead-in In this module, you will learn about the nontransactional data access layer and how to create a logical design and a physical design for it. 2 Module 8: The Nontransactional Data Access Layer # ## # Introduction to the Data Access Layer ! The Business Problem ! Splitting the DAL The DAL buffers the entire system from the underlying data services. All access to data services for creating, updating, or deleting is accomplished through the DAL. In this section, the DAL is introduced and discussed in the context of the business problem for accessing data services. You will also learn about the technologies necessary to implement the nontransactional DAL. Many of these technologies are also used for the transactional DAL, which is discussed in Module 9, “The Transactional Data Access Layer.” Topic Objective To provide an overview of the section topics and objectives. Lead-in In this section, you will learn about what makes up a nontransactional DAL. Module 8: The Nontransactional Data Access Layer 3 The Business Problem Data Access Layer Connected Business Logic Layer Disconnected Business Logic Layer Facade Layer Web Services Facade Business Facade Transactional DAL Nontransactional DAL User Services Data Services The data services store and manage all of the data used by the system. Access to the data services requires detailed knowledge of where and how the data is stored. For example, an order entry system might store orders in several tables in a Microsoft ® SQL Server ™ database. To create a new order, a system must know the name of the computer running SQL Server, the name of the database, and the names of the tables in which the orders are stored. If the business logic or facades were to access the data services directly, they would have to be programmed and compiled with much of this information in the components. Changes to the data services, such as changing the computer name, database name, or table structures, would require changes in the business logic and facades. A DAL isolates the rest of the system from changes in the data services. Using the DAL, the business logic or facades only pass or request the data they need, without any dependency on where or how that data is stored. The DAL is programmed with the information necessary to locate data servers and update the data. Therefore changes to the data services will require only the DAL to be recompiled, not any components in the business logic or facades. A subtle but important detail in this architecture is that the business and Web services facades can access the DAL directly. If the facades need to retrieve or update data in a manner that does not require business logic to be involved, there is no need to go through the business logic layer. The facades simply access whatever components they need in the DAL to accomplish their goals. Topic Objective To provide background about the business problem. Lead-in In this topic, you will learn about the business problem facing designers who need to implement a DAL. 4 Module 8: The Nontransactional Data Access Layer Splitting the DAL ! Nontransactional only applies to retrieving data. ! Transactional only applies to creating, updating, and deleting data. ! COM+ declares transactions at a class level. ! Split entity classes into transactional and nontransactional classes. The DAL is split into two separate parts. One part, called the nontransactional DAL, only exposes functionality to retrieve data. The other part, called the transactional DAL, exposes functionality to create, update, and delete data. The DAL is split into two parts because transactions take a lot of overhead. When a COM+ class declares that it requires transactions, the Microsoft Distributed Transaction Coordinator (MS DTC) must create and manage the transactions. This overhead is not necessary when only retrieving data, so the methods dealing with data retrieval are put in the nontransactional DAL. This is an important distinction because most classes you derive in your logical design will combine transactional and nontransactional methods. For example, a customers table in the database should have a Customers class that exposes methods such as GetCustomer, CreateCustomer, and UpdateCustomer. GetCustomer is a nontransactional method because it does not change the table. However, CreateCustomer and UpdateCustomer require a transaction to update the database. COM+ declares transactions at a class level. Either the entire class requires transactions, or the entire class does not support transactions. Therefore the GetCustomer method is split off into another class, which only has methods that retrieve data. In your logical design, you should already have this architecture in mind while creating classes for the DAL. The following are the key functions for the nontransactional DAL: ! Receive requests from the business or Web services facade layer or business logic. ! Process the requests and pass them to data services. ! Retrieve the results from data services. ! Pass the results of the processing back to the facade layer or business logic. Topic Objective To discuss the advantage of splitting off certain pieces of the DAL into transactional and nontransactional components. Lead-in In this topic, you will learn about the reasons for splitting the DAL into two separate parts. [...]... Connection object to access the data source Module 8: The Nontransactional Data Access Layer 11 ADO Programming ADO provides the means for an application to perform the following sequence of actions: 1 Connect to a data source 2 Specify a command to gain access to the data source 3 Execute the command 4 If the command causes data to be returned in the form of rows in a table, store the rows in a cache... in which there is one row for each partition in the child rowset 16 Module 8: The Nontransactional Data Access Layer Using Data Shaping Creating a hierarchy is a two-step process that requires connection to the Data Shaping Provider and then uses the SHAPE command You can also use the Data Shaping provider from ADO When you use Data Shaping from ADO, you must setup an explicit connection to the OLE... validate the data when the receiving application does not have a built-in description of the incoming data DOM With the XML Document Object Model (DOM), you can load and parse XML files, gather information about those files, and navigate and manipulate those files 20 Module 8: The Nontransactional Data Access Layer Schema A schema is a formal specification of the rules of an XML document, namely the element... client application 5 On the client, the Recordset object is processed 6 Any modifications to the Recordset object on the client are sent back to the server program, which uses them to update the data source 12 Module 8: The Nontransactional Data Access Layer Record Topic Objective To provide an overview of the Record object Lead-in In this topic, you will learn about one of the new objects available... general, the iterator class is combined with the aggregate class since only one traversal mechanism is necessary In the physical design, the ADO Recordset class is used to implement all of the iterators If OLE DB were being used, then the OLE DB rowset would be the equivalent representation of the Iterator design pattern 28 Module 8: The Nontransactional Data Access Layer # Physical Design of Nontransactional. .. to separate the iterator methods from the aggregate methods Under these circumstances, consider joining the aggregate and iterator classes 26 Module 8: The Nontransactional Data Access Layer Iterator Pattern Example An example of the Iterator pattern is the collection in Visual Basic For example, the following code shows how to add two new users to a users collection, and then update the account codes... present the data in a browser XML separates the data from the presentation and the process, enabling you to display and process the data as you wish by applying different style sheets and applications DTD With XML, Document Type Definitions (DTDs) can accompany a document, essentially defining the rules of the document, such as which elements are present and the structural relationship between the elements... to perform the following sequence of actions: 1 Specify the program to be invoked on the server, and obtain a way to refer to it from the client 2 Invoke the server program Pass parameters to the server program that identify the data source and the command to issue 3 The server program obtains a Recordset object from the data source 4 The server program returns the final Recordset object to the client... ! Lead-in Microsoft Data Access Components Active Directory Service Interfaces The design of components for the nontransactional DAL is based on data access technologies for accessing hierarchical as well as non-hierarchical data In this section, the following data access technology topics will be covered in detail: ! Microsoft Data Access Components (MDAC) ! OLE DB ! ActiveX™ Data Objects (ADO) !.. .Module 8: The Nontransactional Data Access Layer 5 # Nontransactional DAL Technologies Topic Objective To provide background about the technologies for implementing nontransactional DAL ! ! ActiveX Data Objects ! Record ! Stream ! Cursor Service ! Data Shaping Service ! Issues and Challenges of Data Exchange ! XML Solution ! In this topic, you will learn about the technologies for implementing nontransactional . it. 2 Module 8: The Nontransactional Data Access Layer # ## # Introduction to the Data Access Layer ! The Business Problem ! Splitting the DAL The DAL. nontransactional DAL. 6 Module 8: The Nontransactional Data Access Layer Microsoft Data Access Components Other Data Sources Other Data Sources Relational Databases

Ngày đăng: 21/12/2013, 06:17

TỪ KHÓA LIÊN QUAN