private static void ValidateMappings <TTarget>(IDataRecord reader) { List <PropertyInfo> props = new List <PropertyInfo>(CDataMapper.GetSourceProperties(typeof(TTarget))); for (int i = 0; i < reader.FieldCount; i++) { PropertyInfo propinfo = props.Find( delegate(PropertyInfo pi) { return(pi.Name == reader.GetName(i) ? true : false); }); if (propinfo == null) { string err = string.Format("Property '{0}' of type '{1}' is missing from the type '{2}'", reader.GetName(i), reader.GetFieldType(i), typeof(TTarget).FullName); throw new Exception(err); } } }