Click here to Skip to main content
6,595,444 members and growing! (18,982 online)
Email Password   helpLost your password?
Web Development » ASP.NET » General     Beginner License: The Code Project Open License (CPOL)

4 steps to use readymade DAL component (Data application blocks)

By Shivprasad koirala

4 steps to use readymade DAL component (Data application blocks)
C# (C# 1.0, C# 2.0, C# 3.0), SQL, UML, VB 7.x, VB 8.0, VB 9.0, VB 6, Windows (Win2K, WinXP, Win2003, Vista, TabletPC), .NET 1.0, .NET 1.1, .NET 2.0, Mono, DotGNU, .NET 3.0, .NET 3.5, ASP.NET, SQL Server (SQL 2000, SQL 2005, SQL CE), Visual Studio (VS.NET2003, VS2005, VS2008), ADO.NET, Architect
Version:2 (See All)
Posted:16 Oct 2008
Updated:24 Mar 2009
Views:7,060
Bookmarked:23 times
Unedited contribution
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
15 votes for this article.
Popularity: 2.82 Rating: 2.40 out of 5
9 votes, 60.0%
1
1 vote, 6.7%
2

3
1 vote, 6.7%
4
4 votes, 26.7%
5
Updated with links of Other Application Blocks

4 steps to use readymade DAL component (Data application blocks)
 

Introduction

One of the most important components in a project is the DAL component. Many developers end up creating their own DAL component which is pretty time consuming. A Microsoft enterprise application block has a very decent and time tested DAL component i.e. the Enterprise data application blocks. This tutorial will run through the necessary steps of how you can use Enterprise data application blocks in your DAL component.

I have been writing and recording lot of architecture related videos on design patterns, UML , estimation and C# projects. You can see the sample videos at http://www.questpond.com/FreeDesign1.htm.

 

Other Application Blocks

Validation application blocks: - This article explains the 16 steps you need to perform to do validations using VAB.Validation application blocks

Client side validation: - One of the short comings in VAB is that it does only server side validations. This article talks how we can leverage VAB for client side.Client side validation

Dynamic validation: - This article explains how to build dynamic validation on scenario basis.Dynamic validation

Policy Application blocks: - This article talks how to implement plug and play mechanism using Policy application blocks.Policy application block

Logging application block: - This article explains the 5 basic steps of how to use logging application blocks.
Logging application block

Exception application block: - This application talks how we can use exception application blocks to log exception from project.Exception application block

Unity application block: - This application talks about Unity Application Block in DI and IOC.Unity application block

UIP block: - This article talks about Reusable Navigation and workflow for both Windows and Web using Microsoft UIP blocks.UIP block

Step1 :- Install enterprise application blocks from http://www.microsoft.com/downloads/details.aspx?FamilyId=90DE37E0-7B42-4044-99BE-F8ECFBBC5B65&displaylang=en 
Once you install the block open the enterprise library configuration screen.
 

Step2:- Open the project web.config file in which you want to reuse the data application block. Once you have opened the web.config file we need to provide ConnectionString as shown in the below figure.


Step 3:- Save the setting and then set the default database to the currently configure connection string. In this sample we have renamed the connection string to ‘MyDatabase’. So we have selected the default database as ‘MyDatabase’.
 

Step 4 :- Now that we done all the configuration we need to write the code to call the data application block. First step import the two important namespaces of enterprise library. In the second step use the databasefactory static class to create the database object. If you remember we had made the ‘MyDataBase’ as a default. So the factory uses the default connection string to create the database object.

In the third step pass the stored procedure which needs to be executed. If the stored procedure has input parameters you can use the overloaded method to pass the data. Currently we want to get the dataset to bind with the grid so we have called the ‘ExecuteDataset’ function. In the final step we have binded the same with data grid.
 

Nine lines of code compressed to three lines of code
 

Ok what have we achieved by this. Nine lines of code has become three lines of code…PRODUCTIVITY
 

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Shivprasad koirala


Member
He thinks he was born for only one mission and thats technology.Keeping this mission in mind he established www.questpond.com where he has uploaded 500 videos on WCF,WPF,WWF,Silverlight,Design pattern, FPA , UML , Projects etc. He is also actively involved in RFC which is a financial open source made in C#. It has modules like accounting , invoicing , purchase , stocks etc.
Occupation: Architect
Company: http://www.questpond.com
Location: India India

Other popular ASP.NET articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 1 of 1 (Total in Forum: 1) (Refresh)FirstPrevNext
Generalgood article PinmemberDonsw10:11 20 Apr '09  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 24 Mar 2009
Editor:
Copyright 2008 by Shivprasad koirala
Everything else Copyright © CodeProject, 1999-2009
Web21 | Advertise on the Code Project