Esempio n. 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="data"></param>
        /// <param name="errors"></param>
        /// <returns></returns>
        public static IList <T> Map <T>(IDictionary data, IErrors errors) where T : class, new()
        {
            var mapper  = new MapperIni <T>();
            var results = mapper.Map(data, errors);

            return(results);
        }
Esempio n. 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="content">The content.</param>
        /// <param name="isPath">if set to <c>true</c> [is path].</param>
        /// <param name="dataTypeKeyName">Name of the data type key.</param>
        /// <param name="factoryMethod">The factory method.</param>
        /// <returns></returns>
        public static IList <T> MapIniAs <T>(string content, bool isPath, string dataTypeKeyName, Func <string, T> factoryMethod) where T : class, new()
        {
            var doc     = new IniDocument(content, isPath);
            var errors  = new Errors();
            var mapper  = new MapperIni <T>();
            var results = mapper.Map(doc, errors, true, dataTypeKeyName, factoryMethod);

            return(results);
        }