![]() |
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
Published: Wednesday, June 25, 2003 By John Jakovich
Introduction
Application Blocks are C# and VB.NET classes distributed as Visual Studio projects that can be downloaded from Microsoft's Web site and used in any .NET application, including ASP.NET Web applications. They are useful and powerful tools that can make applications more maintainable, scaleable and efficient. In 2002, Microsoft released two Application Blocks that encapsulate two of the most common programming tasks: data access and exception management. These two Application Blocks contain classes, static methods and interfaces that greatly simplify SQL Server data access and application exception management. In this article we will examine the two Application Blocks and discuss their benefits and how to get started using them! The article Examining the Data Access Application Block delves into the Data Access Application Block, examining how to use it in an ASP.NET Web application.
Introducing the Data Access and Exception Management Application Blocks
These static methods can be used to return To get started with the Data Access Application Block you must first download the installer at http://download.microsoft.com/download/VisualStudioNET/daabref/RTM/NT5/EN-US/DataAccessApplicationBlock.msi. To learn more about this Application Block be sure to read the article Examining the Data Access Application Block, which examines this Application Block in more detail specifically examining the Block's various methods and how to utilize the Block in an ASP.NET Web application. The second Application Block encapsulates exception management. The Exception Management block provides a framework enabling you to log exception information, isolate exception code from your business logic and manage exceptions efficiently and consistently. The Exception block also provides excellent base classes and interfaces that can be used to create your own exception management framework or extend the Application Block to met the needs of your particular system. The Exception Management Block can be downloaded at http://download.microsoft.com/download/VisualStudioNET/emabref/RTM/NT5/EN-US/ExceptionManagementApplicationBlock.msi. Application Blocks were designed by reviewing successful and efficient .NET applications and combining the optimum implementations into classes for our use. As a result, Application Blocks incorporate the current best practices endorsed by Microsoft. However, the greatest facet of Application Blocks is that they are surprisingly well documented. Each Application Block is distributed with complete documentation and source code examples. Even the source code is commented. I highly recommend downloading the Blocks and browsing the code. Application Blocks are part of a larger effort by Microsoft to push their own variety of system architecture recommendations for .NET applications called Patterns and Practices.
A Brief Look at Patterns and Practices "Patterns are an effective way to convey architecture, design and implementation guidance for .NET in a language that is already familiar to many enterprise IT professionals. Patterns are instantiated in Reference Architectures, Reference Building Blocks and IT Services, and LifeCycle Practices. Each patterns also has an associated GotDotNet Community for collaboration and discussion." You may be asking yourself, "Sounds nice, but what exactly is a pattern"? A pattern is a way to describe commonly encountered problems. For example, many of us have written (or will write) code that authenticates users for access to a Web site. Our tools are frequently the same, username and password text boxes, a submit button and the code that is executed behind the scenes to perform the validation. The process of logging-in a user can be abstracted and defined as a pattern. We could further identify certain practices that would facilitate the authentication pattern, making it easier and more efficient to perform the various tasks involved in logging-in a user. The process of defining patterns enables us to design more abstract solutions to address the common situations we encounter when programming any system. The key to finding the best solution for a pattern is not to ask yourself "How do I solve this problem" but instead, "How do I solve these types of problems". Application Blocks are Microsoft's implementation of two common patterns, efficient database interaction and consistent application exception management.
The Benefits of Using Application Blocks
Getting Started With Application Blocks
The installer package will create an entry in your Start Menu -> Program Files called
"Microsoft Application Blocks for .NET". There you will find the source code (C# and VB),
documentation, and Quick Start examples. To begin, select either C# or VB from the "Microsoft
Application Blocks for .NET" menu The selected Project will open in Visual Studio. After the
project loads, take some time to browse the source code, then build the assembly (from the Build menu
select Build Solution). Once the assembly
has built, you can start using the Application Block(s) in your Visual Studio .NET projects by adding a
reference the created assembly. For example, to use the Data Access Application Block, you would
add a reference to the assembly
Conclusion For a closer look at the Data Access Application Block, be sure to read Examining the Data Access Application Block! Happy Programming!
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||