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

            TicketCodeDbContextConfigurer.Configure(builder, configuration.GetConnectionString(TicketCodeConsts.ConnectionStringName));

            return(new TicketCodeDbContext(builder.Options));
        }
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <TicketCodeDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 TicketCodeDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 TicketCodeDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }