Presentation is loading. Please wait.

Presentation is loading. Please wait.

Leveraging Application Blocks in Your Application Development Ihsan Anabtawi Technology Specialist Microsoft ® Corporation.

Similar presentations


Presentation on theme: "Leveraging Application Blocks in Your Application Development Ihsan Anabtawi Technology Specialist Microsoft ® Corporation."— Presentation transcript:

1 Leveraging Application Blocks in Your Application Development Ihsan Anabtawi Technology Specialist Microsoft ® Corporation

2 What We Will Cover Introduction to: Introduction to:  Data Access Application Block  Exception Management Application Block  Configuration Management Application Block  Updater Application Block

3 Session Prerequisites Level 200 Familiarity with Microsoft Visual Studio ®.NET Familiarity with Microsoft Visual Studio ®.NET Understanding of Microsoft Visual C# ® Understanding of Microsoft Visual C# ® Basic understanding of Microsoft SQL Server™ 2000 Basic understanding of Microsoft SQL Server™ 2000

4 Demonstrations Demo 1 – Introduction to the Data Access Application Block Demo 1 – Introduction to the Data Access Application Block Demo 2 – Introduction to the Exception Management Application Block Demo 2 – Introduction to the Exception Management Application Block Demo 3 – Introduction to the Configuration Management Application Block Demo 3 – Introduction to the Configuration Management Application Block Demo 4 – Introduction to the Updater Application Block Demo 4 – Introduction to the Updater Application Block

5 Agenda Introduction Introduction Data Access Application Block Data Access Application Block Exception Management Application Block Exception Management Application Block Configuration Management Application Block Configuration Management Application Block Updater Application Block Updater Application Block Session Summary Session Summary

6 Introduction What are Application Blocks? Create less custom code Create less custom code Encapsulate best practices Encapsulate best practices Based on real applications Based on real applications

7 Introduction Available Application Blocks Authorization and Profile Authorization and Profile Aggregation Aggregation Asynchronous Invocation Asynchronous Invocation Caching Caching Logging Logging User Interface Process User Interface Process Data Access Data Access Exception Management Exception Management Configuration Management Configuration Management Updater Updater

8 Introduction What Do Application Blocks Include? Visual Studio.NET Projects Visual Studio.NET Projects  Microsoft Visual Basic ®.NET and Visual C# source code  Quick Start Samples Documentation Documentation  Developing Applications  Design and Implementation  Deployment and Operations  Reference Available from: http://www.microsoft.com/downloads Available from: http://www.microsoft.com/downloads

9 Agenda Introduction Introduction Data Access Application Block Data Access Application Block Exception Management Application Block Exception Management Application Block Configuration Management Application Block Configuration Management Application Block Updater Application Block Updater Application Block Session Summary Session Summary

10 Data Access Application Block Main Elements

11 Data Access Application Block Using the SqlHelperParameterCache Class Managing parameters Managing parameters  CacheParameterSet  GetCachedParameterSet  GetSpParameterSet Caching and retrieving parameters Caching and retrieving parameters Retrieving stored procedure parameters Retrieving stored procedure parameters

12 Demo 1 Introduction to the Data Access Application Block

13 Demonstration Summary Using the SqlHelper class Using the SqlHelper class  SqlHelper::ExecuteNonQuery()  SqlHelper::ExecuteDataSet()  SqlHelper::ExecuteReader() Supporting transactions Supporting transactions

14 Data Access App. Block SqlHelper Class Public Functions ExecuteNonQuery This method is used to execute commands that do not return any rows or values. ExecuteReader This method is used to return a SqlDataReader object that contains the resultset returned by a command. ExecuteDataset This method returns a DataSet object that contains the resultset returned by a command. ExecuteXmlReader This method returns an XML fragment from a FOR XML query. FillDataset This method is similar to ExecuteDataset, except that a pre- existing DataSet can be passed in, allowing additional tables to be added. UpdateDataset This method updates a DataSet using an existing connection and user-specified update commands. It is typically used with CreateCommand. CreateCommand This method simplifies the creation of a SQL command object by allowing a stored procedure and optional parameters to be provided. This method is typically used with UpdateDataset

15 Data Access App. Block SqlHelper Class Private Functions AttachParameter A function used to attach any necessary SqlParameter objects to the SqlCommand being executed. AttachParameters PrepareCommand A function used to initialize the properties of the command, such as its connection, transaction context, and so on. ExecuteReader This private implementation of ExecuteReader is used to open a SqlDataReader object with the appropriate CommandBehavior to manage the lifetime of the connection associated with the reader most efficiently. Provide a consistent way to execute commands Provide a consistent way to execute commands

16 Agenda Introduction Introduction Data Access Application Block Data Access Application Block Exception Management Application Block Exception Management Application Block Configuration Management Application Block Configuration Management Application Block Updater Application Block Updater Application Block Session Summary Session Summary

17 Exception Management Application Block Publishing Exceptions

18 Exception Management Application Block Internal Design

19 Exception Management Application Block Design Elements BaseApplicationException Class BaseApplicationException Class  Computer name where the exception was created  Date and time when the exception occurred  Name of the application domain hosting your application  Thread identity where the exception occurred  Windows identity of the thread  Additional custom information ExceptionManagerSectionHandler Class ExceptionManagerSectionHandler Class ExceptionManager Class ExceptionManager Class

20 Exception Management Application Block Design Elements ExceptionManagerInstaller class ExceptionManagerInstaller class  Automatic instantiation  Manual instantiation DefaultPublisher class DefaultPublisher class IExceptionPublisher and IExceptionXmlPublisher interfaces IExceptionPublisher and IExceptionXmlPublisher interfaces

21 Exception Management Application Block Configuration format <configuration> <section name="exceptionManagement" <section name="exceptionManagement" type=" Microsoft.ApplicationBlocks.ExceptionManagement type=" Microsoft.ApplicationBlocks.ExceptionManagement ExceptionManagerSectionHandler, ExceptionManagerSectionHandler, Microsoft.ApplicationBlocks.ExceptionManagement" /> Microsoft.ApplicationBlocks.ExceptionManagement" /> <publisher mode="on/off" assembly="AssemblyName" <publisher mode="on/off" assembly="AssemblyName" type="TypeName" exclude="(+)Type,(+)Type" type="TypeName" exclude="(+)Type,(+)Type" include="(+)Type,(+)Type"exceptionFormat="xml" customattr = "value" /> include="(+)Type,(+)Type"exceptionFormat="xml" customattr = "value" /> </configuration>

22 Exception Management Application Block Configuration Summary Enable or disable publishers Enable or disable publishers Include or exclude exception types Include or exclude exception types Exception detail format Exception detail format Custom attributes Custom attributes

23 Demo 2 Introduction to the Exception Management Application Block

24 Demonstration Summary Creating custom exceptions Creating custom exceptions Publishing custom exceptions Publishing custom exceptions Using Exception Block configuration files Using Exception Block configuration files Creating custom publishers Creating custom publishers

25 Exception Management Application Block Extending the Exception Management Application Block Why extend? Why extend? Creating a custom publisher Creating a custom publisher  Custom publisher  Receive details Configure the custom publisher Configure the custom publisher

26 Agenda Introduction Introduction Data Access Application Block Data Access Application Block Exception Management Application Block Exception Management Application Block Configuration Management Application Block Configuration Management Application Block Updater Application Block Updater Application Block Session Summary Session Summary

27 Configuration Management Application Block Using the Configuration Management Application Block Simplicity Simplicity Flexible data model Flexible data model Storage location independence Storage location independence Data security and integrity Data security and integrity Performance Performance Extensibility Extensibility

28 Configuration Management Application Block Internal Design

29 Configuration Management Application Block Reading a Named Configuration Section Hashtable configData; // Read the configuration section named AppConfig configData = (Hashtable)ConfigurationManager.Read("AppConfig"); (Hashtable)ConfigurationManager.Read("AppConfig");

30 Configuration Management Application Block Writing a Named Configuration Section Hashtable configData; // Write the configuration section named AppConfig ConfigurationManager.Write("AppConfig",configData);

31 Configuration Management Application Block Reading the Default Configuration Section Hashtable configData; // Read the default configuration section // (must be Hashtable-based) configData = (Hashtable)ConfigurationManager.Read();

32 Configuration Management Application Block Writing the Default Configuration Section Hashtable configData; // Write the default configuration section // (must be Hashtable-based) ConfigurationManager.Write(configData);

33 Configuration Block Documentation

34 Demo 3 Introduction to the Configuration Management Application Block-

35 Demonstration Summary The ConfigurationManager class The ConfigurationManager class  Read  Write Encrypting configuration settings Encrypting configuration settings Providing alternate storage locations Providing alternate storage locations

36 Agenda Introduction Introduction Data Access Application Block Data Access Application Block Exception Management Application Block Exception Management Application Block Configuration Management Application Block Configuration Management Application Block Updater Application Block Updater Application Block Session Summary Session Summary

37 Updater Application Block When to Use the Updater Application Block Update applications Update applications vs. Windows Forms downloads vs. Windows Forms downloads vs. Centralized management systems vs. Centralized management systems vs. IntelliMirror vs. IntelliMirror

38 Updater Application Block Using the Updater Application Block

39 Demo 4 Introduction to the Updater Application Block

40 Demonstration Summary Configuring, writing and running a self- updating application Configuring, writing and running a self- updating application Using AppStart.exe Using AppStart.exe Using ManifestUtility.exe Using ManifestUtility.exe

41 Updater Application Block Developing Controllers Application to control the updater Application to control the updater ApplicationUpdateManager class ApplicationUpdateManager class  StartUpdater method  StopUpdate method

42 Updater Application Block Developing Downloaders Moving files Moving files IDownloader interface IDownloader interface BITS BITS  Transfers are restartable  Manageability  Security  Prioritized transfers Custom downloader class Custom downloader class

43 Updater Application Block Developing Validators Manage cryptographic signatures Manage cryptographic signatures IValidator interface IValidator interface Included validators Included validators Custom validators Custom validators

44 Updater Application Block Developing Post-Validators Post-deployment configuration Post-deployment configuration IPostProcessor interface IPostProcessor interface Implementing IPostProcessor Implementing IPostProcessor

45 Agenda Introduction Introduction Data Access Application Block Data Access Application Block Exception Management Application Block Exception Management Application Block Configuration Management Application Block Configuration Management Application Block Updater Application Block Updater Application Block Session Summary Session Summary

46 Session Summary Reusable code Reusable code Best practices applied to common programming tasks Best practices applied to common programming tasks

47 For More Information… MSDN Web site at MSDN Web site at  msdn.microsoft.com Microsoft Patterns and Practices on MSDN Microsoft Patterns and Practices on MSDN

48 Training and Events MSDN Webcasts, MSDN Online Seminars, Tech·Ed, PDC, Developer Days MSDN Essential Resources for Developers Subscription Services Online Information Membership Programs Print Publications Library, OS, Professional, Enterprise, Universal Delivered via CD-ROM, DVD, Web MSDN Online, MSDN Flash, How-To Resources, Download Center MSDN User Groups MSDN Magazine MSDN News

49 MSDN Webcasts Interactive, Live Online Events Interactive, synchronous, live online events Interactive, synchronous, live online events Discuss the hottest topics from Microsoft Discuss the hottest topics from Microsoft Open and free for the general public Open and free for the general public Take place every Tuesday Take place every Tuesdayhttp://www.microsoft.com/usa/webcasts

50 MSDN Subscriptions THE way to get Visual Studio.NET Visual Studio.NET MSDN Subscriptions NEW Professional Tools to build applications and XML Web services for Windows and the WebTools to build applications and XML Web services for Windows and the Web MSDN Professional $1199 new $899 renewal/upgrade MSDN Enterprise $2199 new $1599 renewal/upgrade MSDN Universal $2799 new $2299 renewal/upgrade Enterprise Developer Enterprise lifecycle toolsEnterprise lifecycle tools Team development supportTeam development support Core.NET Enterprise ServersCore.NET Enterprise Servers Enterprise Architect Software and data modelingSoftware and data modeling Enterprise templatesEnterprise templates Architectural guidanceArchitectural guidance

51 Where Can I Get MSDN? Visit MSDN Online at msdn.microsoft.com Visit MSDN Online at msdn.microsoft.com Register for the MSDN Flash e-mail newsletter at Register for the MSDN Flash e-mail newsletter atmsdn.microsoft.com/flash Become an MSDN CD subscriber at msdn.microsoft.com/subscriptions Become an MSDN CD subscriber at msdn.microsoft.com/subscriptions MSDN online seminars MSDN online seminarsmsdn.microsoft.com/training/seminars Attend more MSDN events Attend more MSDN events

52 Microsoft Press ® Essential Resources for Developers Microsoft Visual Studio ®.NET is here! This is your chance to start building the next big thing. Develop your.NET skills, increase your productivity with.NET books from Microsoft Press www.microsoft.com/mspress

53 Become a Microsoft Certified Solution Developer What is MCSD? What is MCSD?  Premium certification for professionals who design and develop custom business solutions How do I attain MCSD certification? How do I attain MCSD certification?  Pass four exams to prove competency with Microsoft solution architecture, desktop applications, distributed application development, and development tools Where do I get more information? Where do I get more information?  For more information about certification requirements, exams, and training options, visit www.microsoft.com/mcp

54 Training Training Resources for Developers Course Title: Course Title:  Course Number:  Availability:  Detailed Syllabus: www.microsoft.com/traincert Course Title: Course Title:  Course Number:  Availability:  Detailed Syllabus: www.microsoft.com/traincert To locate a training provider for this course, please access www.microsoft.com/traincert Microsoft Certified Technical Education Centers are Microsoft’s premier partners for training services

55 © 2004 Microsoft Corporation. All rights reserved. Microsoft, the.NET logo, Visual Basic, Visual C#, Visual J#, Visual Studio, the Visual Studio logo, Windows, the Windows logo, Active Directory, MSDN, and Microsoft Press are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. The names of actual companies and products mentioned herein may be the trademarks of their respective owners.


Download ppt "Leveraging Application Blocks in Your Application Development Ihsan Anabtawi Technology Specialist Microsoft ® Corporation."

Similar presentations


Ads by Google