.netSavant rc1 released!

February 23, 2008

I’m proud to announce the release of my new code generating addin, .netSavant.  You can download the release candidate on the website from our download page.

The addin will help you create robust ado.net code with an intuitive drag and drop interface.  Additionally it will generate best practice implementations of three (currently) system interfaces:

  • System.IEquatable<T>
  • System.IDisposable
  • System.ICloneable

Currently I am working on the example code that will help to explain how to best use the ado.net code that is generated.  I’m also working on more and better F.A.Q. entries to answer those pesky little problems that come along with learning a new tool.

If there is any functionality that you’d like to see added to the addin let me know; I’ll entertain any reasonable request.

Enjoy!


nullable types and ado.net parameters

January 5, 2008

As most people are aware the .NET 2.0 framework supports nullable value types.  There are many articles on this topic and a few that address the issues of using nullable types in combination with your ado.net code.  However, most of these discuss the issue of using nullable types in combination with the DbDataReader objects, though few address the conflicts that arise when using a nullable type to set or get an ado.net parameter value.

Prior to .net 2.0 you’d run into this issue when attempting to pass a null string to the value of an input parameter.  In this case most of us would have written conditional code that looked something like this:


string firstName = null;
if(firstName == null) {
    Command.Parameters["FirstName"].Value = DBNull.Value;
} else {
    Command.Parameters["FirstName"].Value = firstName;
} 

Or you could have used a ternary operation: 


string firstName = null;
Command.Parameters["FirstName"].Value = firstName == null ? (object)DBNull.Value : firstName;

Read the rest of this entry »