Пример #1
0
        public L11_HelloWorkDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <L11_HelloWorkDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            L11_HelloWorkDbContextConfigurer.Configure(builder, configuration.GetConnectionString(L11_HelloWorkConsts.ConnectionStringName));

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