public LocalCoreDbContext CreateDbContext(string[] args)
        {
            var builder = new DbContextOptionsBuilder <LocalCoreDbContext>();

            //var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            MyDocumentManageDbContextConfigurer.Configure(builder, AppConfigurtaionServices.GetAppSettings()["ConnectionStrings:mydb"]);

            return(new LocalCoreDbContext());
        }
Esempio n. 2
0
        public DbContextOptions <LocalCoreDbContext> GetDbContextOption()
        {
            var builder = new DbContextOptionsBuilder <LocalCoreDbContext>();

            //var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            //MyDocumentManageDbContextConfigurer.Configure(builder, configuration.GetConnectionString("mydb"));

            MyDocumentManageDbContextConfigurer.Configure(builder, AppConfigurtaionServices.GetAppSettings()["ConnectionStrings:mydb"]);
            return(builder.Options);
        }
 public override void PreInitialize()
 {
     if (!SkipDbContextRegistration)
     {
         Configuration.Modules.AbpEfCore().AddDbContext <LocalCoreDbContext>(options =>
         {
             if (options.ExistingConnection != null)
             {
                 MyDocumentManageDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
             }
             else
             {
                 MyDocumentManageDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
             }
         });
     }
 }