StoredProc2DotNET:
Click here to Download
Now!How much .NET code
are you writing today to fetch, update or delete data? If you
think it is a bit too much, this is the utility that you need.
StoredProc2DotNET identifies
all stored procedures in a specified database and generates
.NET source code that allows calling these stored procedures
as methods of a class. Executing stored procedures now becomes a
single line of code and eliminates the need to create SqlParameters, SqlCommands, SqlConnection
etc. StoredProc2DotNet also integrates with Microsoft
Data Access Application Block for connecting, retrieving and
update data.
Microsoft Data Access Application Block for .NET consists of a
single .NET-based assembly, which contains all the necessary
functionality to perform most common data access tasks. By using
the Data Access Application Block in your applications, you can
minimize the data access code and ensure that your data access
logic is implemented in an efficient, standardized and effective
manner.
If you were to call a Stored Procedure to GetEmployeeInfo, it
would be:
//Retrieve the parameter set
SqlParameter[] storedParams = new SqlParameter[0];
storedParams = SqlHelperParameterCache.GetSpParameterSet(
ConnectionString ," GetEmployeeInfo ");
storedParams[0].Value = @tiid;
DataSet ds;
// Call ExecuteDataset static method of SqlHelper class that returns a Dataset
ds = SqlHelper.ExecuteDataset(ConnectionString,
CommandType.StoredProcedure,
"GetEmployeeInfo ",
storedParams);
Even through it is less code compared to the
usual way of creating each parameter and Command it still has
some things can can be painful to the developer. For example,
rather than specifying each
parameter separately, it requires that you remember the
sequence of the parameters, remember the data type for each
parameter and always know the exact stored procedure name. Also,
it is still a few lines of code and if you have more than one
parameter it can become much larger.
Using StoredProc2DotNET, it converts the above line into a
single line and now our code becomes:
ds = StoredProcs.GetEmployeeInfo(1);
 |