Пример #1
0
        /// <summary>
        /// Convert table to target enumerable
        /// </summary>
        /// <param name="table">Table</param>
        /// <param name="type">Target type</param>
        /// <param name="expression">Mapping expression</param>
        /// <param name="exclude">One-based row indices to exclude</param>
        /// <returns>Target enumerable</returns>
        public static IEnumerable <object> Convert(this Table table, Type type, string expression, params int[] exclude)
        {
            var generator = new TableMapper(type).Map(expression);

            if (exclude != null && exclude.Length > 0)
            {
                generator.Exclude(exclude);
            }
            return(Convert(table, generator));
        }
Пример #2
0
        /// <summary>
        /// Convert table to target enumerable
        /// </summary>
        /// <typeparam name="T">Target type</typeparam>
        /// <param name="table">Table</param>
        /// <param name="expression">Mapping expression</param>
        /// <param name="exclude">One-based row indices to exclude</param>
        /// <returns>Target enumerable</returns>
        public static IEnumerable <T> Convert <T>(this Table table, string expression, params int[] exclude) where T : new()
        {
            var generator = new TableMapper <T>().Map(expression);

            if (exclude != null && exclude.Length > 0)
            {
                generator.Exclude(exclude);
            }
            return(Convert(table, generator));
        }