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

            AzureAiDbContextConfigurer.Configure(builder, configuration.GetConnectionString(AzureAiConsts.ConnectionStringName));

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