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

            SafenetDbContextConfigurer.Configure(builder, configuration.GetConnectionString(SafenetConsts.ConnectionStringName));

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