Exemplo n.º 1
0
        /// <summary>
        /// 获取转换函数
        /// </summary>
        /// <typeparam name="T">类型</typeparam>
        /// <param name="row">单元行</param>
        private static Func <IList <ICell>, T> GetFunc <T>(IRow row)
        {
            var propertyNames = string.Empty;

            row.Cells.ForEach(cell => propertyNames += cell.PropertyName + "_");
            var key   = typeof(T).FullName + "_" + propertyNames.Trim('_');
            var props = typeof(T).GetProperties().Where(x => x.CanWrite && x.CanRead && !x.HasIgnore());
            var func  = ExpressionMapper.GetFunc <T>(key, props);

            return(func);
        }