Ejemplo n.º 1
0
        public TimesheetDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <TimesheetDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            TimesheetDbContextConfigurer.Configure(builder, configuration.GetConnectionString(TimesheetConsts.ConnectionStringName));

            return(new TimesheetDbContext(builder.Options));
        }
Ejemplo n.º 2
0
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <TimesheetDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 TimesheetDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 TimesheetDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }