Click here to Skip to main content
11,932,103 members (51,090 online)
Click here to Skip to main content
Add your own
alternative version


65 bookmarked

C# DAL Method Code Generator

, 19 May 2008 CPOL
Rate this:
Please Sign up or sign in to vote.
Generates C# data access layer method code for SQL Server stored procedures
Click to enlarge


DAL Method Generator is a simple utility to generate data access layer methods in C# for SQL Server stored procedures. Have you ever written too many data access layer methods in C# to connect to SQL server stored procedures? This utility could save your effort using few clicks.

Using the Utility

C# DAL Method Generator is written using C# and you will require .NET Framework 2.0 to execute.

To use the utility, just invoke the EXE, which should open the Connect to SQL Server dialog below. It uses Windows authentication to connect to the SQL Server. Future work includes connecting to various other data stores like Oracle, etc. with other authentication as well.

Sample Image - maximum width is 600 pixels

Once connected to the server, you can drill down to see the databases and stored procedures for which you have permission.

Sample Image - maximum width is 600 pixels

To select all the stored procedures in a database, right click-on the node "Stored Procedures" and click "Add all Stored Procs to List". To add selected stored procedures, right click on them and choose, "Add to List". Selected stored procedures will appear on the right pane. Provide the method name for the C# method, by default the system uses the stored procedure name only. Also choose the return type for the method. By default, all methods generated return void.

Click to enlarge

To generate C# DAL methods, click on File -> Generate Code or the Generate Code Tool bar item. The code will be generated as below:

Click to enlarge

Points of Interest

I would like to extend it further to generate C# business entity, DAL method, basic CRUD stored procedures for the business entity based on table definitions and also to support other data stores.


  • 19th May, 2008: Initial post


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


About the Author

Singapore Singapore
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralMy vote of 5 Pin
Md. Marufuzzaman21-Dec-11 4:14
mvpMd. Marufuzzaman21-Dec-11 4:14 
GeneralGreate tool Pin
Member 247899423-Apr-11 3:07
memberMember 247899423-Apr-11 3:07 
GeneralWill this work for Oracle (ODP.Net) Pin
Het210911-Jun-08 10:55
memberHet210911-Jun-08 10:55 
GeneralRe: Will this work for Oracle (ODP.Net) Pin
Saravanan.B12-Jun-08 5:56
memberSaravanan.B12-Jun-08 5:56 
QuestionWhy not using DataTables? Pin
bytejaeger28-May-08 12:05
memberbytejaeger28-May-08 12:05 
GeneralGreat tool Pin
kalyankrishna120-May-08 1:00
memberkalyankrishna120-May-08 1:00 
GeneralGreat tool. [modified] Pin
milan19-May-08 23:36
membermilan19-May-08 23:36 
GeneralRe: Great tool. Pin
dangrass3-Jun-08 10:35
memberdangrass3-Jun-08 10:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.151126.1 | Last Updated 19 May 2008
Article Copyright 2008 by Saravanan.B
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid