protected TEntity Map <TEntity>(System.Data.IDataRecord record) { var objT = Activator.CreateInstance <TEntity>(); foreach (var property in typeof(TEntity).GetProperties()) { if (record.HasColumn(property.Name) && !record.IsDBNull(record.GetOrdinal(property.Name))) { property.SetValue(objT, record[property.Name]); } } return(objT); }