private static object GetMappedParentObject(this DbDataReader odr, object obj, IEnumerable <ColumnMap> columnMaps) { foreach (var map in columnMaps) { if (map.IsChildMap) { odr.SetParentProperties(obj, map.ParentMap); } else { DbConnectorUtilities.SetChildProperty(obj, map, odr.GetValue(map.Column.Ordinal)); } } return(obj); }
public static object GetMappedObject(this DbDataReader odr, Type objType, IEnumerable <ColumnMap> columnMaps) { object obj = Activator.CreateInstance(objType); foreach (var map in columnMaps) { if (map.IsChildMap) { odr.SetParentProperties(obj, map.ParentMap); } else { DbConnectorUtilities.SetChildProperty(obj, map, odr.GetValue(map.Column.Ordinal)); } } return(obj); }