private static IEnumerable <T> MapByRow <T>(DataTable dt) { var context = new MapBuilderContext <T>(); foreach (DataRow row in dt.Rows) { yield return(context.MapRow(row)); } }
/// <summary> /// Returns a <see cref="IMapBuilderContext<TResult>"/> that can be used to build a <see cref="IRowMapper<TResult>"/>. /// The <see cref="IMapBuilderContext<TResult>"/> has a mapping set up for all properties of <typeparamref name="TResult"/> based on name. /// </summary> /// <seealso cref="IMapBuilderContext<TResult>"/> /// <seealso cref="IRowMapper<TResult>"/> /// <returns>A new instance of <see cref="IMapBuilderContext<TResult>"/>.</returns> public static IMapBuilderContext <TResult> MapAllProperties() { IMapBuilderContext <TResult> context = new MapBuilderContext(); var properties = from property in typeof(TResult).GetProperties(BindingFlags.Instance | BindingFlags.Public) where IsAutoMappableProperty(property) select property; foreach (var property in properties) { context = context.MapByName(property); } return(context); }
public static void ToMappingParameter <T>(this Dictionary <string, object> dic, T obj) { var context = new MapBuilderContext <T>(); context.GetPameters(dic, obj); }
public MapBuilderContextMap(MapBuilderContext builderContext, PropertyInfo property) { this.property = property; this.builderContext = builderContext; }