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

            CCodeDbContextConfigurer.Configure(builder, configuration.GetConnectionString(CCodeConsts.ConnectionStringName));

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