Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 50 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
50
Dung lượng
1,15 MB
Nội dung
Contents
Overview 1
Lesson: Design of Data-CentricApplications 2
Lesson: ADO.NET Architecture 9
Lesson: ADO.NETand XML 19
Multimedia: ADO.NETand XML 22
Demonstration: ADO.NETand XML 23
Review 28
Lab 1.1: Data-CentricApplicationsand
ADO.NET 30
Module 1:Data-Centric
Applications and
ADO.NET
Information in this document, including URL and other Internet Web site references, is subject to
change without notice. Unless otherwise noted, the example companies, organizations, products,
domain names, e-mail addresses, logos, people, places, and events depicted herein are fictitious,
and no association with any real company, organization, product, domain name, e-mail address,
logo, person, places or events is intended or should be inferred. Complying with all applicable
copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part
of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted
in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or
for any purpose, without the express written permission of Microsoft Corporation.
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.
2001-2002 Microsoft Corporation. All rights reserved.
Microsoft, MS-DOS, Windows, Windows NT, Win32, Active Directory, ActiveX, BizTalk,
IntelliSense, JScript, MSDN, SQL Server, Visual Basic, Visual C#, Visual C++, Visual J#, Visual
Studio, and Windows Media are either registered trademarks or trademarks of Microsoft
Corporation in the U.S.A. and/or other countries.
The names of actual companies and products mentioned herein may be the trademarks of their
respective owners.
Module1:Data-CentricApplicationsandADO.NET iii
Instructor Notes
This course contains code samples in two programming languages: Microsoft
®
Visual Basic
®
and Microsoft Visual C#
™
. The use of these two programming
languages will accommodate students who are currently Visual Basic
programmers and might be considering working with Visual C#, and students
who are C, Microsoft Visual C++
®
, Java, and Visual C# programmers who do
not have Visual Basic experience. The lab exercises have solutions in both
languages. Most examples are also in both programming languages, except
when the differences between the languages are minor.
Access the code examples by clicking the hyperlinks at the bottom of the
Microsoft PowerPoint
®
slides during your presentation. The examples are
displayed in Microsoft Internet Explorer. The examples for each module are
contained in a single .htm file for that module. You can navigate to different
examples within the example files. To avoid running multiple instances of
Internet Explorer, close each instance after you have finished with a code
example.
This module teaches students about the design of data-centricapplications
(including connected and disconnected environments), Microsoft ADO.NET
architecture, andADO.NETand XML.
After completing this module, students will be able to:
!
Give examples of storage options.
!
Diagram the architecture of data-centric applications.
!
Choose a connected, disconnected, or mixed environment based on
application requirements.
!
Use the System.Data namespaces in applications.
!
Diagram the ADO.NET object model.
!
Analyze typical business scenarios.
!
Describe the use of XML in ADO.NET.
To teach this module, you need the following materials:
!
Microsoft PowerPoint file 2389B_01.ppt
!
Module 1, “Data-Centric Applicationsand ADO.NET”
!
Lab 1, Data-CentricApplicationsandADO.NET
To prepare for this module:
!
Read all of the materials for this module.
!
Complete the practices and labs.
!
Read the latest .NET Development news at
http://msdn.microsoft.com/library/default.asp?url=/nhp/Default.asp?contenti
d=28000519
Presentation:
60 Minutes
Lab:
30 Minutes
Required materials
Preparation tasks
iv Module1:Data-CentricApplicationsandADO.NET
This module contains multimedia animations. To start an animation, click the
movie projector button on the PowerPoint slide for the multimedia. When the
multimedia window opens, click the Start button
.
This course contains code examples that are linked to text hyperlinks at the
bottom of PowerPoint slides. These examples enable you to teach from code
examples that are too long to display on a slide. All of the code examples for
this module are contained in one .htm file. Students can copy the code directly
from the browser or from the source, and paste it into a development
environment
To display a code sample, click a text hyperlink on a slide. Each link opens an
instance of Internet Explorer and displays the code associated with the link. At
the end of each example is a link that displays a table of contents of all
examples in this module. After you have finished teaching the code for an
example, close the instance of the browser to conserve resources.
If time constraints occur, one or more practices in this module can be presented
as instructor-led demonstrations.
Multimedia
Hyperlinked code
examples
Practices
Module1:Data-CentricApplicationsandADO.NET v
How to Teach This Module
This section contains information that will help you to teach this module.
Lesson: Design of Data-CentricApplications
This section describes the instructional methods for teaching each topic in this
lesson. This lesson should not take more than 25 minutes.
Technical Notes:
!
Emphasize that ADO.NET can support any data storage format for which
there is a .NET data provider, OLE DB provider, or ODBC driver.
!
Third party organizations are likely to quickly support the .NET data
provider standard and supply native .NET data providers.
Discussion Questions: Personalize the following question to the background of
the students in your class.
• Which data storage models do you need to access in your company?
Technical Notes: The key word is constantly connected.
Be careful not to get drawn into a philosophical discussion about
what is a connected or disconnected environment.
Discussion Questions: Personalize the following questions to the background
of the students in your class.
!
What are the advantages of the connected environment?
!
What are the disadvantages of using a connected environment?
Technical Notes:
!
The key word is constantly connected.
!
Emphasize that most real-world environments use a combination of
connected and disconnected solutions.
Discussion Questions: Personalize the following question to the background of
the students in your class.
• Do your applications use a connected or disconnected environment?
Data Storage
What Is a Connected
Environment?
Warnin
g
What Is a Disconnected
Environment?
vi Module1:Data-CentricApplicationsandADO.NET
Technical Notes:
!
Emphasize that most real-world environments use a combination of
different tiered solutions.
!
Balance is a good key word here. Improving one aspect of a solution tends
to worsen another. Difficult design decisions must be made based on what is
best for a particular situation.
!
Remember KISS: “Keep It Simple, Simon”
Discussion Questions: Personalize the following questions to the background
of the students in your class.
!
What are some problems with 2-tier applications? How scalable is this type
of application?
!
What kinds of security are available with the different application models?
Transition to Practice Exercise: Instruct students to turn to the practice
exercise at the end of this topic in the student workbook.
The purpose of this practice is to relate the topics we have discussed to
applications that you have built or will build in your work environment.
Data Access
Application Models
Module1:Data-CentricApplicationsandADO.NET vii
Lesson: ADO.NET Architecture
This section describes the instructional methods for teaching each topic in this
lesson. This lesson should not take more than 20 minutes.
Technical Notes: In some ways you can think of ADO.NET as a marketing
term that covers the classes in the System.Data namespace.
Technical Notes: The students should already know how to reference
assemblies and import namespaces, but some will not, so be prepared to explain
the fundamentals of namespaces. Appendix D, “Microsoft .NET Framework
Overview,” in Course 2389B, Programming with Microsoft ADO.NET, covers
the fundamentals of Microsoft .NET, including namespaces.
Transition to Practice Exercise: Instruct students to turn to the practice
exercise at the end of this topic in the student workbook.
The purpose of this practice is to provide experience referencing an assembly
and importing a namespace.
Technical Notes:
The slide does not show all ADO classes (for example, Record and Stream).
Many students will not have used the ADO Recordset in a disconnected
scenario.
You might want to spend a few minutes explaining ADO.NET functionality and
limitations while discussing the benefits for DataSets.
Transition to Practice Exercise: Instruct students to turn to the practice
exercise at the end of this topic in the student workbook.
The purpose of this practice is to discuss different ways of using ADO.NETand
relate the classroom discussions to applications you may be building or working
with.
Technical Notes: The ADO.NET object model consists of two major parts: the
DataSet classes and the .NET data provider classes.
The DataSet class has a Tables property, which gets a collection of DataTable
objects in the DataSet, and a Relations property, which gets a collection of the
DataRelation objects in the DataSet.
What Is ADO.NET?
What Are the Data-
Related Namespaces?
Evolution of ADO to
ADO.NET
The ADO.NET Object
Model
viii Module1:Data-CentricApplicationsandADO.NET
Technical Notes: Stress to the students that the connection is open during the
processing of the DataReader, and therefore resources are being used on the
server.
Discussion Questions: Personalize the following questions to the background
of the students in your class.
Why is using the SQL Server .NET Data Provider more efficient than using the
OLE DB .NET Data Provider for SQL Server?
What is the purpose of the XxxDataReader class?
Technical Notes: Stress to the students that the connection is open during the
retrieval of the dataset, but not during the processing of the data. The
processing can include reading the rows, sorting, filtering, and editing the data.
Therefore, resources are not used on the server while this processing occurs.
Later, a new connection is made and the changes are sent to the data source.
Discussion Questions: Personalize the following question to the background of
the students in your class.
What class is used in the disconnected environment that is not used in the
connected environment?
Using ADO.NET Classes
in a Connected Scenario
Using ADO.NET Classes
in a Disconnected
Scenario
Module1:Data-CentricApplicationsandADO.NET ix
Lesson: ADO.NETand XML
This section describes the instructional methods for teaching each topic in this
lesson. This lesson should not take more than 15 minutes. ADO.NETand XML
is discussed in detail in Module 5: “Reading and Writing XML with
ADO.NET,” in Course 2389B, Programming with Microsoft ADO.NET.
Technical Notes: Do not spend long on this topic, because you will need plenty
of time for the multimedia and demonstration. Explain that ADO.NET uses
XML extensively, and that the course covers XML features in detail later.
This multimedia animation describes how a developer can use ADO.NET to
create a distributed solution to a business problem. The Visual Studio .NET
solution includes two projects. The first is an XML Web service and the second
is a Microsoft Windows
®
application that uses the Web service.
Technical Notes:
!
It is important to ensure that this demonstration goes well. Check that the
demonstration executes correctly before the course begins.
!
Familiarize yourself thoroughly with this demonstration.
ADO.NET and XML
Multimedia: ADO.NET
and XML
Demonstration:
ADO.NET and XML
x Module1:Data-CentricApplicationsandADO.NET
Review: Data-CentricApplicationsandADO.NET
This section provides the answers to review questions at the end of this module.
1. What are the characteristics of a connected architecture? Describe some
scenarios where a connected architecture is appropriate.
A connected architecture is one where an application connects directly
to a data source, to query and modify the stored data.
A connected architecture is appropriate for in-house applications that
access a data source over a local area network. Another example is an
ASP.NET Web application that queries a database to generate a read-
only report of the data.
2. What are the characteristics of a disconnected architecture? Describe a
scenario where a disconnected architecture is appropriate.
A disconnected architecture is one where an application does not
connect directly to a data source. ADO.NET provides extensive support
for building disconnected applications, to meet the needs of modern-day
distributed systems.
A disconnected architecture is appropriate for mobile workers. At the
start of the day, a private copy of customer and product data can be
downloaded from the database. During the day, the worker uses and
modifies this copy of the data. At the end of the day, the worker posts
the data changes back to the database. XML Web services have an
important role to play in this style of application.
3. What are the features and advantages of the XML Web service architecture?
Business services are made available to disconnected users. XML Web
services can retrieve private copies of data from a data source to enable
users to work with the data remotely. XML Web services also allow the
user to post data updates back to the data source when required.
[...]... Data Provider, and the OLE DB NET Data Provider The SQL Server NET Data Provider gives optimized access to SQL Server 2000 and SQL Server 7.0 databases The OLE DB NET Data Provider gives access to SQL Server 6.5 (and earlier), Oracle, Sybase, and other databases Module1:Data-CentricApplicationsandADO.NET 1 Overview ! Design of Data-CentricApplications ! ADO.NET Architecture ! ADO.NETand XML *****************************ILLEGAL... USE****************************** Introduction This lesson introduces ADO.NETand establishes its place in the Microsoft NET Framework Lesson objectives After completing this lesson, you will be able to: ! Explain how to use ADO.NET ! Discuss how ADO.NET is divided into namespaces ! Diagram the ADO.NET object model 10 Module1:Data-CentricApplicationsandADO.NET What Is ADO.NET? ADO.NET is a set of classes for working with... connection Module 1:Data-CentricApplicationsandADO.NET 19 Lesson: ADO.NETand XML ! ADO.NETand XML ! Multimedia ! Demonstration *****************************ILLEGAL FOR NON-TRAINER USE****************************** Introduction This lesson introduces the ADO.NET functions that relate to XML and XML Web services Lesson objectives After completing this lesson, you will be able to: ! Explain how to use ADO.NET. .. to a DataSet Reference See Appendix B, “ADO andADO.NET Comparison,” for more information about the reasons for the changes between ADO andADO.NET 14 Module1:Data-CentricApplicationsandADO.NET The ADO.NET Object Model DataSet SQL Server NET SQL Server NET Data Provider Data Provider OLE DB NET OLE DB NET Data Provider Data Provider SQL Server 7.0 (and later) OLEDB sources (SQL Server 6.5) *****************************ILLEGAL... to access Did the architecture use a connected or disconnected environment? Module1:Data-CentricApplicationsandADO.NET 9 Lesson: ADO.NET Architecture ! What Is ADO.NET? ! What Are the Data-Related Namespaces? ! Evolution of ADO to ADO.NET ! The ADO.NET Object Model ! Using ADO.NET Classes in a Connected Scenario ! Using ADO.NET Classes in a Disconnected Scenario *****************************ILLEGAL... the namespace for the DataSet and SqlConnection classes: ' Visual Basic Dim dsNorthwind As DataSet Dim cnNorthwind As SqlConnection // Visual C# DataSet dsNorthwind; SqlConnection cnNorthwind; 8 Save the changes to your project and close the Visual Studio NET development environment Module 1:Data-CentricApplicationsandADO.NET 13 Evolution of ADO to ADO.NET Command Command XxxConnection XxxConnection.. .Module 1:Data-CentricApplicationsandADO.NET xi 4 How does ADO.NET increase the interoperability and scalability of disconnected systems? XML makes interoperability possible Data from a data source can be expressed in XML format, which makes it easier to exchange the data between application tiers and across organizational boundaries XML is tightly integrated into the design and philosophy of ADO.NET. .. disconnected, or mixed environment based on application requirements ! Use the System.Data namespaces in applications ! Diagram the ADO.NET object model ! Analyze typical business scenarios ! Explain how to use ADO.NET with XML 2 Module1:Data-CentricApplicationsandADO.NET Lesson: Design of Data-CentricApplications ! Data Storage ! What Is a Connected Environment? ! What Is a Disconnected Environment?... completing this lesson, you will be able to: ! Explain how to use ADO.NET with XML ! Describe how a simple XML Web service works with ADO.NET 20 Module1:Data-CentricApplicationsandADO.NETADO.NETand XML ! ADO.NET is tightly integrated with XML ! Using XML in a disconnected ADO.NET application XML Web Services Client Data Source 1 1 Request data 2 2 4 4 XML DataSet DataSet 3 3 5 5 Updated XML DataSet... and Transforming Data Using XML and XSLT ! Course 2091A, Building XML-Enabled Applications using Microsoft® SQL Server™ 2000 ! Course 2500A, Introduction to XML and the Microsoft NET Platform 22 Module1:Data-CentricApplicationsandADO.NET Multimedia: ADO.NETand XML ! This animation describes how an XML Web service uses ADO.NET *****************************ILLEGAL FOR NON-TRAINER USE****************************** . demonstration.
ADO. NET and XML
Multimedia: ADO. NET
and XML
Demonstration:
ADO. NET and XML
x Module 1: Data-Centric Applications and ADO. NET
Review: Data-Centric. 1 .1: Data-Centric Applications and
ADO. NET 30
Module 1: Data-Centric
Applications and
ADO. NET
Information in this document, including URL and