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

            ManageCloudDevicesDbContextConfigurer.Configure(builder, configuration.GetConnectionString(ManageCloudDevicesConsts.ConnectionStringName));

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