private static object CreateObject(Type objType, IDataReader dr) { object objectValue = RuntimeHelpers.GetObjectValue(Activator.CreateInstance(objType)); if (objectValue is IHydratable) { IHydratable hydratable = objectValue as IHydratable; if (hydratable != null) { hydratable.Fill(dr); } } else { CBO.HydrateObject(RuntimeHelpers.GetObjectValue(objectValue), dr); } return(objectValue); }
private static T CreateObject <T>(IDataReader dr) { T instance = Activator.CreateInstance <T>(); if ((object)instance is IHydratable) { IHydratable hydratable = (object)instance as IHydratable; if (hydratable != null) { hydratable.Fill(dr); } } else { CBO.HydrateObject((object)instance, dr); } return(instance); }