Content by Category
.NET 1.x
.NET 2.0
.NET 3.0
.NET 3.5
.NET 4.0
.NET Assemblies
.NET Framework
.NET Getting Started
Accessibility
ADO.NET
Advertorials
Agile Development
AJAX
Architecture
ASP.NET
ASP.NET MVC
ASP.NET WebForms
Azure
B2B (Business Integration)
Bing
BizTalk
Book Excerpts
Build and Deploy
C#
C++
ClickOnce
Cloud Computing
Code Contracts
CODE on the Road!
COM+
Community
Conferences
Continuous Integration
Crystal Reports
CSLA.NET
CSS
Data
Design Patterns
Development Process
Display Technologies
Distributed Computing
DotNetNuke
DSL
Dynamic Programming
Editorials
Enterprise Services ("COM+")
Entity Framework
Events
Expression Blend
F#
Fox to Fox
Frameworks
Functional Programming
Git
Graphics
Internet Explorer 8.0
Interviews
iPhone
Iron Ruby
Java
Java Script
jQuery
LINQ
Linux
Mac OS X
MDX
Microsoft Application Blocks
Microsoft Business Rules Framework
Microsoft Dynamics
Microsoft Expression
Microsoft Office
Mobile Development
Mobile PC
Mono
MsBuild
Network
NHibernate
Object Oriented Development
Odata
Open Source
Opinion
Opinions
Oracle
ORM
Other Languages
Parallel Programming
Patterns
Podcasts
Post Mortem
PowerPoint
Print/Output
Prism
Product News
Product Reviews
Project Management
Python
Q&A
Rails
Rake
Reporting Services
REST
RIA Services
Ruby
Ruby on Rails
Search
Security
Services
SharePoint
Silverlight
SOA
Social Networks
Software & Law
Software Business
Source Control
Speech-Enabled Applications
SQL Server
SQL Server 2000
SQL Server 2005
SQL Server 2008
SQL Server CE/AnyWhere/Mobile/Compact
SSIS
Subversion
Sync Framework
Tablet PC
TDD
Team System
Techniques
Testing and Quality Control
Tips
UI Design
UML
User Groups
VB Script
VB.NET
Version Control
VFP and .NET
VFP and SQL Server
Virtual Earth
Vista
Visual Basic
Visual Basic 6 (and older)
Visual FoxPro
Visual Studio .NET
Visual Studio 2005
Visual Studio 2008
Visual Studio 2010
Visual Studio Tools for Office
VSX
WCF
Web Development (general)
Web Services
WF
Whitepapers
Windows 7
Windows Azure
Windows Live
Windows Server
Windows Vista
WinForms
Workflow
WPF
XAML
XML
XNA
XSLT



DevConnections


 


iPhone iPad Developers Conference

Reader rating:
Click here to read 8 comments about this article.
Article source: CoDe (2004 - November/December)


Article Pages:  1  2 3 - Next >


Data Access with Microsoft Application Blocks

ADO.NET SQL Data access made simple and efficient.Microsoft has created a set of libraries known as Application Blocks. These libraries will help developers reduce the amount of code they must write while using the current best practices. One of the components, Data Access Application Block for .NET, addresses Microsoft SQL Server data access by wrapping up data access into a helper class.

When Microsoft introduced .NET, they introduced a new data access architecture called ADO.NET. This new data access architecture is the next evolution from COM-based ADO. ADO.NET provides a lot of new features for accessing data such as datasets, which are essentially an in-memory database, and data adapters that allow different data providers to interact with a DataSet. This model allows datasets to be completely data provider-independent giving you the option of changing the data provider used to fill a DataSet and update data from a DataSet. You can even use multiple data providers with a single DataSet?fancy that! Of course you will find some classes such as a Connection class, Parameter class, and Command class that perform the same basic function as their ADO predecessor. With ADO.NET's new features and enhancements, of course, comes extra complexity when you write your data access code; you never had to deal with a data adapter in the past. Wouldn't you like someone to encapsulate all that complexity into a series of classes and methods to handle 95% of your data access logic needs? You're in luck.

Microsoft has introduced the Patterns & Practices Web site. (http://www.microsoft.com/resources/practices/), which contains Microsoft's suggested practices and design patterns guidelines for designing, developing, deploying, and managing the life cycle of software solutions. The Patterns & Practices Web site contains the following four types of methods for sharing these guidelines: (design) Patterns, Reference Architectures, Reference Building Blocks and IT Services, and Lifecycle Practices. Together these guidelines provide far better guidance for developing strong solutions compared to simple white papers or books alone.

The Reference Building Blocks and IT Services guidelines provide designs and components for building reusable sub-systems in your software solutions. The components of this guideline are referred to as Application Blocks. Table 1 lists the eleven Application Block components that were available at the time this article was written.

One of the Reference Building Blocks that the Microsoft practices & patterns team has introduced is a data access helper framework called the Data Access Application Block for .NET, which you can download from http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/daab-rm.asp. This data access helper framework provides a series of static methods for simplifying CRUD (Create, Read, Update, and Delete) operations. It contains two main classes: the SqlHelper class, and the SqlHelperParameterCache class. The SqlHelper class provides for simplified data access to a SQL server database and the SqlHelperParameterCache class caches SqlParameters for a given command as well as connection so that you can reuse them at any given time. Together these classes encapsulate the code you will need to perform most of your routine data access logic.

&

By: Keenan Newton

Keenan is a Senior Consultant for Magenic Technologies, Inc., one of the nation's premiere Microsoft Gold Certified Partners, focused on delivering business value through applied technology. He has over eight years of experience designing, architecting, and developing n-tier applications for both Windows and Web environments.

knewton@calamos.com

Fast Facts

Microsoft recently launched the Microsoft patterns & practices section of their Web site, offering several complete architectural and design application blocks, complete with source code, that you can use in your .NET applications.



Table 1: Current Application Block components available at the time this article was written.
Application BlockDescription
Aggregation Application BlockThis Application Block contains a component that sends requests to a series of dispatchers to return data from various service providers in a single data entity such as a dataset or XML document.
Asynchronous Invocation Application BlockThis Application Block manages asynchronous communication between an application and service providers.
Authorization and Profile Application BlockThis Application Block gives you the ability to manage role-based authorization and profile information in your applications.
Caching Application BlockThis Application Block provides an infrastructure to cache data from service providers such as a Web service or database.
Configuration Management Application BlockThis Application Block provides a simple and consistent interface for reading and writing application configuration data.
Data Access Application BlockThis Application Block contains a component that has functionality to simplify the most common methods for accessing Microsoft SQL Server database servers via the .NET SqlClient class.
Exception Management Application BlockThis Application Block provides a framework for logging exception information and publishing to the event log, or you can create your own custom publisher.
Logging Application BlockThis Application Block uses the Enterprise Instrumentation Framework (EIF) to assist in the development of instrumented applications.
Smart Client Offline Application BlockThis Application Block provides an infrastructure to develop applications with offline capabilities.
Updater Application BlockThis Application Block helps you recognize, validate, and download updated application files from a central location.
User Interface Process Application BlockThis Application Block provides a series of components that assist the developer in creating UI process components.


Article Pages:  1  2 3 - Next Page: 'SqlHelper Class' >>

Page 1: Data Access with Microsoft Application Blocks
Page 2: SqlHelper Class
Page 3: Working with the Data Access Application Block

How would you rate the quality of this article?
1 2 3 4 5
Poor      Outstanding

Tell us why you rated the content this way. (optional)

Average rating:
3.3 out of 5

31 people have rated this article.
      CODE TRAINING

 

Free Webinar