Ejemplo n.º 1
0
        /// <summary>
        ///     DataTable转换为数组实体类
        /// </summary>
        /// <param name="dt">源DataTable</param>
        /// <typeparam name="TEntity">实体类</typeparam>
        public static TEntity[] ToArray <TEntity>(this DataTable dt)
        {
            var mapData = DataReaderHelper.DataTableToDictionary(dt);
            var type    = new EntityDynamics().BuildType(typeof(TEntity));

            return(((List <TEntity>)InstanceStaticCacheManger.Cache(type, "ToList", (object)mapData)).ToArray());
        }