I am trying to support UInt32 in my application.By looking example given at this location,i wrote my code. NHibernate - How to store UInt32 in database. In my hbm file i defined property tag:
<property name="Uint16Var" column="Uint16Var"
type="datatypeSupported.UInt32Type, datatypeSupported" />
and i also defined a UInt32Type class like this:
using System;
using NHibernate;
using NHibernate.SqlTypes;
using NHibernate.UserTypes;
namespace datatypeSupported
{
public class UInt32Type : IUserType
{
public object NullSafeGet(System.Data.IDataReader rs, string[] names, object owner)
{
int? i = (int?)NHibernateUtil.Int32.NullSafeGet(rs, names[0]);
return (UInt32?)i;
}
public void NullSafeSet(System.Data.IDbCommand cmd, object value, int index)
{
UInt32? u = (UInt32?)value;
int? i = (Int32?)u;
NHibernateUtil.Int32.NullSafeSet(cmd, i, index);
}
public Type ReturnedType
{
get
{
return typeof(Nullable<UInt32>);
}
}
public SqlType[] SqlTypes
{
get
{
return new SqlType[] { SqlTypeFactory.Int32 };
}
} public object Assemble(object cached, object owner)
{
return cached;
}
public object DeepCopy(object value)
{
return value;
}
public object Disassemble(object value)
{
return value;
}
public int GetHashCode(object x)
{
return x.GetHashCode();
}
public bool IsMutable
{
get { return false; }
}
public object Replace(object original, object target, object owner)
{
return original;
}
public new bool Equals(object x, object y)
{
return x != null && x.Equals(y);
}
}
}
but still when i try to save my entity, it gives a error "Dialect does not support DbType.UInt32".What type of changes i required to do ?