protected Type GetDataType(string col, ClassMapping mapping)
{
Type colType = null;
// Use the explicit type if there is one.
if (mapping.DataColTypesByDataCol.ContainsKey(col))
{
colType = mapping.DataColTypesByDataCol[col];
}
// Otherwise use the type of the member on the mapped object.
if ((colType == null) && (mapping.AllObjMemberInfosByDataCol.ContainsKey(col)))
{
MemberInfo info = mapping.AllObjMemberInfosByDataCol[col];
if (info is FieldInfo)
{
colType = ((FieldInfo)info).FieldType;
}
else if (info is PropertyInfo)
{
colType = ((PropertyInfo)info).PropertyType;
}
}
// Default behavior is assume string since pretty much everything can be stored
// as a string. This should generally only happen for DictionaryDAOs.
if (colType == null)
{
colType = typeof(string);
}
return colType;
}