easyBlog

EasyObjects and the Enterprise Library

About the author

Author Name is someone.
E-mail me Send mail

Recent comments

Authors

Tags

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2009

Calling a stored procedure using the DAAB

It seems to me there are more than a few on the Enterprise Library forums (http://www.codeplex.com/entlib/Thread/List.aspx) about how to call a stored procedure using the Data Access Application Block (DAAB). And every once in a while the question of how to get a return value from a stored procedure surfaces.

Since it's in my nature to be a problem solver, I have pushed out a couple of templates to the MyGeneration template library that will generate the correct DAAB code for you, one for VB and one for C#. The templates handle the following situations:
  • Load the business entity -or- return a DataSet
  • Execute only
  • Return a DataReader
  • Return a RETURN_VALUE
The templates do not gaurantee perfect code for every scenario, but at least provide you with a great starting point so you don't have to code the whole thing from scratch. It will automatically detect parameters and their input/output status, a return value if you request it, and add the correct parameters to the procedure and method signature. Checking the Static (or Shared in VB) option will generate proper DAAB code, unchecking it will generate the correct calls for an EO business entity.

It's a great timesaver when you are reverse-engineering an application with existing stored procedures that you have to call (I have been using it to add EasyObjects to the TimeTracker project from www.asp.net). I also use it to generate quick code examples when people ask "How do I call this stored procedure?" on the EntLib forum. People are sometimes shocked at the answer, either they missed something simple in their code, or they can't believe how easy it is.

To me, this is yet another example of why you should be using code generation as a part of your development methodology. It gives you and your development staff (no matter how large) a consistent and repeatable process for creating data access code, while at the same time increasing productivity and reducing errors. And hey, as long as you're checking out code generation, maybe give EasyObjects a spin, too?  ;-)

Next on my list is a template for usage with the ObjectDataSource in ASP.NET.

Invoke a stored procedure - C#
http://www.mygenerationsoftware.com/TemplateLibrary/Template/?id=523a2083-1ca5-4dc9-a0c8-769b452c71e0

Invoke a stored procedure - VB.NET
http://www.mygenerationsoftware.com/TemplateLibrary/Template/?id=13696b88-9b79-402b-87c7-f87f42a7cfbb

Tags:
Posted by mgnoonan on Thursday, February 08, 2007 11:50 PM
Permalink | Comments (4) | Post RSSRSS comment feed

Yet more errors

When doing a release, any release, I try to have a repeatable process in place so that if something goes wrong, I don't have to go back and re-assemble all the files. To do this, I use WinZip 10 with their new "job" files. It allows me to specify files and folders to include and exclude, as well as FTP the finished zip up to the server. Nice and neat, and it saves me a lot of time.

But in this case, it also got me into trouble. It turned out the job file was excluding files in the Configuration folder of the EasyObjects project. So everytime I was rebuilding the zip file, it was excluding a handful of necessary files in order to compile the EO DLL (as you may have noticed). Yikes!  :-O

In order to combat this type of failure, I will add an intermediate step into my release process that unzips the finished zip file into a temporary area, attempts to build the DLL, and fails out if there are any errors. It shouldn't be too hard to write a batch file or something that will do this.

I have posted the corrected zip file in the downloads area, and hopefully that's the end of the compile troubles.

Tags:
Categories: EasyObjects
Posted by mgnoonan on Wednesday, February 07, 2007 11:59 PM
Permalink | Comments (2) | Post RSSRSS comment feed

Quickstart errors

Only 2 things wrong out of a list of 1000, but it still counts...

If you downloaded the EO2 release yesterday, you may have noticed that the QuickStarts are not working due to a few missing files. In fact, these files were removed on purpose because they are not necessary for the functionality available in the free version of EO2. Apparently I didn't save the project properly, so it was still referencing the missing files. Ooops.

I have corrected this and sent the results to a few trusted people for verification, and once I have that I will post an updated zip file. My apologies for the confusion.

Tags:
Categories: EasyObjects
Posted by mgnoonan on Tuesday, February 06, 2007 4:28 AM
Permalink | Comments (1) | Post RSSRSS comment feed

EasyObjects 2.0 Free now available!

Noonan Consulting Inc. is proud to announce the availability of EasyObjects version 2.0. This new release adds some important capabilities for the EasyObjects platform. For the first time, there will be two different versions available: a free version and a paid version (coming soon). As previously announced, this departure from previous versions allows for users to try out and use EasyObjects at no cost, and continue to do so if their needs never grow beyond the free version, but also allows for the continued growth and support for EasyObjects into the future.

EasyObjects 2.0 Free includes the following features:
  • Support for Microsoft's Enterprise Library v. 2.0 (January 2006 release) and .NET 2.0
  • Support for Microsoft SQL Server 2000 and 2005
  • All of the features found in EasyObjects 1.2, except as noted below
The paid version of EO2 contains the following enhancements over the free version:
  • Ability to switch DynamicQueryProviders using configuration settings
  • Ability to specify database logon credentials at runtime, not just through configuration
  • Support for Oracle
  • Support for the Enterprise Library Configuration Tool
There will be more announced when the paid version becomes available (including support options), but the basic differences come down to support for Oracle and being able to change DynamicQueryProviders on the fly. The free version is hard-coded to support SQL 2005, but you can switch it to SQL 2000 by commenting out one line. There is no need to support the EntLib Config Tool in the free version since this is only needed for speicifying the DynamicQueryProvider.

Download EasyObjects.NET 2.0 Free
http://www.easyobjects.net/Downloads/tabid/125/Default.aspx

Keep up with all product announcements
http://www.easyobjects.net/Blog/tabid/124/Default.aspx

Tags:
Categories: EasyObjects
Posted by mgnoonan on Monday, February 05, 2007 1:33 AM
Permalink | Comments (17) | Post RSSRSS comment feed