Exemple #1
0
        /// <summary>
        /// 创建对应的访问层对象
        /// <remarks>创建的对象不保存在集合中,使用完后需手动Dispose。</remarks>
        /// </summary>
        /// <typeparam name="TResult">对应的BLL层对象</typeparam>
        /// <returns>返回对应的BLL层对象</returns>
        public virtual TResult SetScope <TResult> ()
            where TResult : DBContext, new ()
        {
            var result = new TResult();

            result.UseConnection(_db_connection, _loggerfactory);
            return(result);
        }
Exemple #2
0
        /// <summary>
        /// 创建对应的访问层对象
        /// <remarks>创建的对象都一直保存在集合中,直到集合批量Dispose。</remarks>
        /// </summary>
        /// <typeparam name="TResult">对应的BLL层对象</typeparam>
        /// <returns>返回对应的BLL层对象</returns>
        public virtual TResult Register <TResult> ()
            where TResult : DBContext, new ()
        {
            var result = new TResult();

            result.UseConnection(base.DBconnection, base.Loggerfactory);
            AddDbContext(result);
            return(result);
        }
Exemple #3
0
        /// <summary>
        /// 创建对应的BLL层对象
        /// </summary>
        /// <typeparam name="TResult">对应的BLL层对象</typeparam>
        /// <returns>返回对应的BLL层对象</returns>
        new public TResult Set <TResult> ()
            where TResult : DBContext, new ()
        {
            var result = new TResult();

            result.UseConnection(_DB_Connection);
            AddDbContext(result);
            return(result);
        }