/// <summary> /// Creates an instance of target type and fills from a map /// </summary> /// <typeparam name="T"></typeparam> /// <param name="map">The map.</param> /// <returns></returns> public static T FromMap <T>(Dictionary <string, object> map) { IObjectProxy proxy = Get <T>(); T result = (T)proxy.CreateObject(); proxy.ReadFromMap(result, map); return(result); }
/// <summary> /// Converts a list of maps to a list of instances. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="map">The map.</param> /// <returns></returns> public static IList <T> FromListMap <T>(IList <Dictionary <string, object> > map) { if (map == null) { return(null); } IObjectProxy proxy = Get <T>(); IList <T> result = (IList <T>)proxy.CreateList(); foreach (Dictionary <string, object> row in map) { T item = (T)proxy.CreateObject(); proxy.ReadFromMap(item, row); result.Add(item); } return(result); }