Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 34 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
34
Dung lượng
789,85 KB
Nội dung
Contents Overview 1 Introduction to Transactional DAL 2 Technologies 5 Logical Design of Transactional DAL 12 Physical Design of Transactional DAL 13 Market Purchasing 18 Best Practices 21 Lab 9:Transactional DAL 22 Review 30 Module9:TheTransactionalDataAccessLayer 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 Module9:TheTransactionalDataAccessLayer iii Instructor Notes This module provides students with a presentation on thetransactionaldataaccesslayer (DAL). Module 9 is the second of two modules that focus on the DAL: Module 8, “The Nontransactional DataAccess Layer” and Module 9, “The TransactionalDataAccess Layer.” The DAL is an application’s means of access to data services. After completing this module, students will be able to: ! Describe the logical design of a transactional DAL and how to apply design patterns. ! Describe Microsoft ® SQL Server ™ , Microsoft Distributed Transaction Coordinator (MS DTC), and COM+ transactions and synchronization. ! Describe the Compensating Resource Manager (CRM). ! Describe the physical design of a transactional DAL and how to use the technologies presented in this module. 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_09.ppt ! Module9:TheTransactionalDataAccessLayer ! Lab 9:TheTransactional DAL Preparation Tasks To prepare for this module, you should: ! Read all of the materials for this module. ! Complete the lab. Presentation: 60 Minutes Lab: 60 Minutes iv Module9:TheTransactionalDataAccessLayerModule Strategy Use the following strategy to present this module: ! Introduction to Transactional DAL The purpose of this section is to introduce students to the business problem and the requirements for transactional DAL. In the topic “Business Requirements,” emphasize the need for transactions with either MS DTC–compliant resource managers or for compensating transactions with CRMs. ! TechnologiesThe purpose of this section is to introduce students to the technologies that can be used in the physical design of thetransactional DAL. The topics covered include the COM+ and SQL Server transaction mechanism and the CRM architecture. ! Logical Design of Transactional DALThe purpose of this section is to identify the two design patterns that might be useful in the logical design of transactional DAL: Iterator and Composite. ! Physical Design of Transactional DALThe purpose of this section is to show how transactions and CRM can be applied to the physical design of transactional DAL components. ! Market Purchasing The purpose of this section is to discuss the logical and physical designs of transactional DAL in Market Purchasing and to justify the choices made. By using Component Services, you can present the Market Purchasing DAL COM+ application. Explain that the nontransactional and transactional DAL components are all registered in the same COM+ application because all of thedata is physically on one computer. You might also consider presenting the source code of one of thetransactional DAL components. Don’t show the source code of the mpdaltr.Requisition or mpdaltr.LineItemDetail classes, because that provides the answers to the lab. ! Best Practices The best practices focus on choosing transacted COM+ components rather than SQL Server implicit transactions in the physical design of thetransactional DAL and the recommendation to use a CRM for nontransactional data service providers. Lab Strategy ! Lab 9:TheTransactional DAL The purpose of Lab 9 is for students to learn to design thetransactional 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 9. Module9:TheTransactionalDataAccessLayer 1 # ## # Overview ! Introduction to Transactional DAL ! Technologies ! Logical Design of Transactional DAL ! Physical Design of Transactional DAL ! Market Purchasing ! Best Practices Module 9 is the second of two modules that focus on thedataaccesslayer (DAL). In Module 8, “The Nontransactional DataAccess Layer,” you learned about data retrieval. In this module, you will learn about data manipulation. After completing this module, you will be able to: ! Describe the logical design of a transactional DAL and how to use design patterns. ! Describe Microsoft ® SQL Server ™ , the Microsoft Distributed Transaction Coordinator (MS DTC), and COM+ transactions and synchronization. ! Describe the Compensating Resource Manager (CRM). ! Describe the physical design of a transactional DAL and how to use the technologies presented in this module. Topic Objective To provide an overview of themodule topics and objectives. Lead-in In this module, you will learn about thetransactional DAL and how to create logical and physical designs for it. 2 Module9:TheTransactionalDataAccessLayer # ## # Introduction to Transactional DAL ! The Business Problem ! Business Requirements Transactionaldataaccess allows facade layer objects and business logic objects to manipulate data from the underlying data storage systems. All of the topics that were covered in the previous module, Module 8, “The Nontransactional DataAccessLayer (DAL),” are relevant in this module as well. In this section, thetransactional DAL will be placed in the proper context of the business problem. This will be followed by a presentation about the business requirements of a transactional DAL. Topic Objective To provide an overview of the section topics and objectives. Lead-in In this section, you will learn what makes up a transactional DAL. Module9:TheTransactionalDataAccessLayer 3 The Business Problem DAL Connected Business Logic Layer Disconnected Business Logic Layer Facade Layer Web Services Facade Business Facade Transactional DAL Nontransactional DAL User Services Data Services Thetransactional DAL facilitates both the retrieval and the modification of data in various formats: database, Active Directory™, and file systems. Business logic layer objects can accessthetransactional DAL. In general, the facade layers do not accessthetransactional DAL because business logic is usually involved during transactions. Thetransactional DAL receives modification requests from the business logic layer. Thetransactional DAL then processes the requests by delegating the requests to thedata services layer. Thetransactional DAL can return to the business logic layer either success or failure. If the transaction also involved retrieving data as a result of updates to the data, a recordset can be returned to the business logic layer. 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 Module9:TheTransactionalDataAccessLayer Business Requirements ! Transactions ! CRMs Transactions Maintaining the integrity of an application’s data across multiple users and computers is an important and difficult task. Thedataaccess associated with transferring a student from one course to another is straightforward: you drop the student from one course and you add the student to the other. When you scale this operation to an enterprise application, you need an infrastructure to carry out the transfer. What happens if the drop succeeds and the add fails? What happens if there is a computer failure immediately after the drop is executed but before the add is executed? For these reasons, you need an infrastructure that provides transaction support. CRMs Typically, most data services are databases that can participate in a transaction, such as SQL Server. Unfortunately, not all data services are databases. For example, Active Directory and Extensible Markup Language (XML) files cannot participate in transactions unless a special effort is undertaken. Nevertheless, the business requirement is for these resources to participate in a transaction. The solution is to implement CRM components for these resources whose data service providers do not allow them to participate in a transaction, thus fulfilling the business requirement. Topic Objective To provide background about the business requirements for implementing thetransactional DAL. Lead-in In this topic, you will learn about the business requirements for implementing transactional DAL. Module9:TheTransactionalDataAccessLayer 5 # ## # Technologies ! Transactions ! Distributed Transactions ! COM+ Transactions ! Architecture of CRM The design of components for thetransactional DAL is based on the same dataaccess technologies as that of the nontransactional DAL. The following dataaccess technologies were covered in Module 8, “The Nontransactional DataAccess Layer”: ! Microsoft DataAccess Components (MDAC) ! OLE DB ! ActiveX ® Data Objects (ADO) ! Record ! Stream ! Cursor Service ! Data Shaping Service ! XML ! Active Directory Service Interfaces (ADSI) The design of physical components for thetransactional DAL is based on using transactions. In this section, you will learn about the following transaction technology topics: ! Transactions ! Distributed transactions ! COM+ transactions In addition, in this section you will learn about the architecture of the CRM. Topic Objective To provide an overview of the section topics and objectives. Lead-in In this section, you will review the technologies associated with transactional DAL. 6 Module9:TheTransactionalDataAccessLayer Transactions ! Local Transactions in SQL Server $ Explicit $ Implicit ! Avoid Local Transactions When Using COM+ and the MS DTC ! Active Directory Transactions In thetransactional DAL, you need to create simple transactions that can affect one row in one table at a time and complex transactions that can affect multiple rows in multiple tables. Local Transactions in SQL Server By default, SQL Server is in autocommit mode. In this mode, each SQL statement, such as UPDATE or INSERT, is encapsulated in a separate transaction as it is run. You can change this behavior by using explicit or implicit transactions. To use an explicit transaction, you issue a BEGIN TRANSACTION statement followed by the SQL statements that are to be run inside the transaction. Then you issue a COMMIT TRANSACTION or ROLLBACK statement to either commit or roll back the transaction. To use implicit transactions, you issue the statement SET IMPLICIT_TRANSACTIONS ON. The next SQL statement you issue, such as UPDATE or INSERT, will begin a new transaction. The transaction will end when you issue a COMMIT TRANSACTION or ROLLBACK statement. Then the next SQL statement will implicitly begin yet another transaction. Avoid Local Transactions When Using COM+ and the MS DTC When using the MS DTC or COM+ transactions, you should avoid using implicit or explicit transactions since the SQL statements you issue will run inside the distributed transaction. Beginning new transactions, implicitly or explicitly, can be semantically confusing and might cause problems with the distributed transaction. Topic Objective To provide a review of transactions. Lead-in In this topic, you will learn how to design transactions in thetransactional DAL. [...]... rolling them back depending on the outcome of the transaction Operation of CRM The first step in the operation of the CRM is the client component’s creation of the CRM Worker The client component then begins using the CRM Worker In the case of the XML CRM Worker, the client component would call the WriteToXML method to write some XML to a file Module 9:TheTransactionalDataAccessLayer 11 The second... properties of the customer before taking an action like creating or getting customer records In addition to the preceding attributes, the topics covered in the previous module, Module 8, The Nontransactional DataAccess Layer, ” apply In particular, the information about object pooling, the constructor string, security, and packaging and deployment also applies to thetransactional DAL 18 Module9:The Transactional. .. DAL tab 4 Add the daltr_DatabaseIDs class and its methods to theTransactional DAL 5 Save the design Module 9:TheTransactionalDataAccessLayer 29 ! Derive the physical design 1 Which COM+ classes and applications should implement the daltr_DatabaseIDs class? Market Purchasing implements the daltr_DatabaseIDs class in a COM+ class called mp_dbid.GetNumber The GetNumber class implements the GetNumber... registered in the Market Purchasing DAL COM+ application ! The CRM classes are contained in a DLL called mpXMLCRM.dll ! The mpXMLCRM.dll is registered in the Market Purchasing XML CRM COM+ application, which is configured to support CRMs The naming convention is to use the name mpdaltr (Market Purchasing dataaccesslayer transactional) for the DLL file name Module 9:TheTransactionalDataAccessLayer 21... with others or with your instructor Module 9:TheTransactionalDataAccessLayer 25 ! Modify the Market Purchasing logical design 1 Click Start, point to Programs, and then click Microsoft Visio 2 On the File menu, click Open, and then open the Market Purchasing.vsd file This file is in the install folder\Labs\Lab09\Start folder 3 In the right pane, click the LD – Transactional DAL tab 4 Add the daltr_Requisition... Directory it is possible to cache the properties locally, and to manipulate the properties in the local cache A CRM can use the cache to write properties while the transaction is pending When the transaction commits, the CRM writes the properties to the underlying directory store If the transaction aborts, the properties are not saved 7 8 Module9:TheTransactionalDataAccessLayer Distributed Transactions... section, you will learn about the physical design considerations of a transactional DAL In this section, you will learn about the physical design of thetransactional DAL In particular, you will learn about designing transactions and a CRM You will then learn how to design the COM+ components that implement thetransactional DAL 13 14 Module9:TheTransactionalDataAccessLayerTransactional Physical Design... the Market Purchasing physical design 1 In the right pane, click the PD – DAL tab 2 Add to the physical design the component or components that you derived to implement the daltr_Requisition and daltr_LineItemDetail classes 3 Save the design Module 9:TheTransactionalDataAccessLayer 27 Exercise 3 Implementing a Transactional DAL Component that Stores State In this exercise, you will design a transactional. .. guidelines were applied to thetransactional DAL of Market Purchasing Module 9:TheTransactionalDataAccessLayer 19 Market Purchasing Logical Design Topic Objective To provide an overview of the logical design for the Market Purchasing transactional DAL ! ! In this topic, you will learn how the logical design for the Market Purchasing transactional DAL was implemented There Is One Design Class for... assembly of other parts Although the Composite design pattern is a structural design pattern, it works very well to help organize data Often the Data Shaping Service implements the Composite design pattern Module 9:TheTransactionalDataAccessLayer # Physical Design of Transactional DAL Topic Objective To provide an overview of the section topics and objectives ! Transactional Physical Design Lead-in . Module 9 is the second of two modules that focus on the DAL: Module 8, The Nontransactional Data Access Layer and Module 9, The Transactional Data Access. Module 9: The Transactional Data Access Layer iii Instructor Notes This module provides students with a presentation on the transactional data access layer