Ejemplo n.º 1
0
        /// <summary>
        ///     数据填充
        /// </summary>
        /// <param name="reader">源IDataReader</param>
        /// <typeparam name="TEntity">实体类</typeparam>
        public static TEntity ToEntity <TEntity>(this IDataReader reader)
        {
            var mapData = DataReaderHelper.DataReaderToDictionary(reader);
            var type    = new EntityDynamics().BuildType(typeof(TEntity));

            return((TEntity)InstanceStaticCacheManger.Cache(type, "ToEntity", (object)mapData, 0));
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     数据填充
        /// </summary>
        /// <param name="reader">源IDataReader</param>
        /// <typeparam name="TEntity">实体类</typeparam>
        public static List <TEntity> ToList <TEntity>(this DbDataReader reader)
        {
            var mapData = DataReaderHelper.DataReaderToDictionary(reader);
            var type    = new EntityDynamics().BuildType(typeof(TEntity));

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