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

            GargleWoolDbContextConfigure.Configure(builder, configuration.GetConnectionString(GargleWoolConstants.ConnectionStringName));

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