Index: src/NHibernate/Mapping/SimpleValue.cs
===================================================================
--- src/NHibernate/Mapping/SimpleValue.cs (revision 5343)
+++ src/NHibernate/Mapping/SimpleValue.cs (working copy)
@@ -262,6 +262,9 @@
{
result = TypeFactory.BuiltInType(typeName, Convert.ToByte(col.Precision), Convert.ToByte(col.Scale));
}
+
+ if (result == null && col.IsLengthDefined ())
+ result = TypeFactory.HeuristicType (typeName, typeParameters, col.Length);
}
return result ?? TypeFactory.HeuristicType(typeName, typeParameters);
}
Index: src/NHibernate/Type/TypeFactory.cs
===================================================================
--- src/NHibernate/Type/TypeFactory.cs (revision 5343)
+++ src/NHibernate/Type/TypeFactory.cs (working copy)
@@ -454,6 +454,19 @@
/// An instance of NHibernate.Type.IType
public static IType HeuristicType(string typeName, IDictionary parameters)
{
+ return HeuristicType (typeName, parameters, null);
+ }
+
+ ///
+ /// Uses heuristics to deduce a NHibernate type given a string naming the
+ /// type.
+ ///
+ /// the type name
+ /// parameters for the type
+ /// used to determine the size of the type
+ /// An instance of NHibernate.Type.IType
+ public static IType HeuristicType(string typeName, IDictionary parameters, int? length)
+ {
IType type = Basic(typeName);
if (type == null)
@@ -518,6 +531,10 @@
{
type = GetSerializableType(typeClass, Int32.Parse(parsedTypeName[1]));
}
+ else if (length.HasValue)
+ {
+ type = GetSerializableType (typeClass, length.Value);
+ }
else
{
type = GetSerializableType(typeClass);