コード例 #1
0
        public ChopstickDockerDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <ChopstickDockerDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            ChopstickDockerDbContextConfigurer.Configure(builder, configuration.GetConnectionString(ChopstickDockerConsts.ConnectionStringName));

            return(new ChopstickDockerDbContext(builder.Options));
        }
コード例 #2
0
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <ChopstickDockerDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 ChopstickDockerDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 ChopstickDockerDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }