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

            IoTDbContextConfigurer.Configure(builder, configuration.GetConnectionString(IoTConsts.ConnectionStringName));

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