Exemple #1
0
        /// <summary>
        /// Map items from the dictionary data to items of Type T.
        /// Each key in the data corresponds to a nested IDictionary which contains key/value
        /// pairs representing the properties/values of the type T.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="items"></param>
        /// <param name="path"></param>
        /// <param name="errors"></param>
        /// <param name="excludeProps"></param>
        /// <returns></returns>
        public static void MapToCsv <T>(IList <T> items, string path, IErrors errors, List <string> excludeProps) where T : class, new()
        {
            var mapper = new MapperCsv <T>();
            IDictionary <string, string> excludedPropsMap = excludeProps.ToDictionary();

            mapper.MapToFile(items, excludedPropsMap, path, errors);
        }
Exemple #2
0
        /// <summary>
        /// Map items from the dictionary data to items of Type T.
        /// Each key in the data corresponds to a nested IDictionary which contains key/value
        /// pairs representing the properties/values of the type T.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="data"></param>
        /// <param name="errors"></param>
        /// <returns></returns>
        public static IList <T> MapCsv <T>(CsvDoc data, IErrors errors) where T : class, new()
        {
            var mapper  = new MapperCsv <T>();
            var results = mapper.Map(data, errors);

            return(results);
        }
Exemple #3
0
        /// <summary>
        /// Map items from the dictionary data to items of Type T.
        /// Each key in the data corresponds to a nested IDictionary which contains key/value
        /// pairs representing the properties/values of the type T.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="items"></param>
        /// <param name="path"></param>
        /// <param name="errors"></param>
        /// <returns></returns>
        public static void MapToCsv <T>(IList <T> items, string path, IErrors errors) where T : class, new()
        {
            var mapper = new MapperCsv <T>();

            mapper.MapToFile(items, null, path, errors);
        }