source/Repid.Core/Context/DataContext.cs

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using Repid.Dapper;
using Repid.Entity;
using Repid.Core.DbSet;
using Repid.Utility.Helper;

namespace Repid.Core.Context
{
    /// <summary>
    /// 数据上下文
    /// </summary
    internal partial class DataContext : IDisposable
    {
        /// <summary>
        /// 私有Ef上下文
        /// </summary>
        private EntitiesContext efContext = null;

        /// <summary>
        /// 私有Dapper上下文
        /// </summary>
        private DapperContext dapperContext = null;

        /// <summary>
        /// 基础数据对象
        /// </summary>
        internal EntitiesContext Ef
        {
            get
            {
                if (efContext == null)
                {
                    efContext = new EntitiesContext("connString");
                }
                return efContext;
            }
        }

        /// <summary>
        /// 扩展数据对象
        /// </summary>
        internal DapperContext Dapper
        {
            get
            {
                if (dapperContext == null)
                {
                    dapperContext = new DapperContext(Ef.Database.Connection);
                }
                return dapperContext;
            }
        }

        /// <summary>
        /// 开始事务
        /// </summary>
        internal void BeginTransaction()
        {
            Dapper.BeginTransaction(Ef.Database.BeginTransaction().UnderlyingTransaction);
后面还有 118 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。