public YTMyprocteDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <YTMyprocteDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            YTMyprocteDbContextConfigurer.Configure(builder, configuration.GetConnectionString(YTMyprocteConsts.ConnectionStringName));

            return(new YTMyprocteDbContext(builder.Options));
        }
Esempio n. 2
0
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <YTMyprocteDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 YTMyprocteDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 YTMyprocteDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
             options.DbContextOptions.UseLoggerFactory(MyLoggerFactory);
             options.DbContextOptions.EnableSensitiveDataLogging(true);       //logging 不加密 development使用 !
         });
     }
 }