コード例 #1
0
        public AccountUnitOfWorkContext()
        {
            var options = EngineContext.Current.Resolve <DbContextOptions <AccountContext> >();

            AccountContext = new AccountContext(options);

            AccountContext.ChangeTracker.LazyLoadingEnabled = false;
        }
コード例 #2
0
        public static void Initialize(IServiceProvider serviceProvider = null)
        {
            DbContextOptions <AccountContext> options = null;

            if (serviceProvider != null)
            {
                options = serviceProvider.GetService <DbContextOptions <AccountContext> >();
            }
            else
            {
                options = EngineContext.Current.Resolve <DbContextOptions <AccountContext> >();
            }

            var accountContext = new AccountContext(options);

            accountContext.Database.Migrate();
        }