private static bool IsValidDataType(Type type)
{
var underlyingType = Nullable.GetUnderlyingType(type);
if (underlyingType != null)
{
return IsValidDataType(underlyingType);
}
return type.IsPrimitive
|| type.IsEnum
|| type == typeof(Decimal)
|| type == typeof(DateTime)
|| type.IsDataAccessObjectType()
|| type == typeof(Guid)
|| type == typeof(TimeSpan)
|| type == typeof(string)
|| type == typeof(byte[]);
}