Wednesday, April 14, 2010

The name 'CastDBNull' does not exist in the current context

The name CastDBNull does not exist in the current context

Generating Data Access Layer using Guidance Package for VS2008 ?(ISimpleDomainObjectFactory)?

using Microsoft.Practices.EnterpriseLibrary.Data

Define this in your code.

public static class CastDBNull
{
public static T To(object value, T defaultValue)
{
if (value == DBNull.Value) return defaultValue;
return (T)Convert.ChangeType(value, typeof(T));
}
}

No comments: