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

            FluentSoftwareDbContextConfigurer.Configure(builder, configuration.GetConnectionString(FluentSoftwareConsts.ConnectionStringName));

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