Ejemplo n.º 1
0
        public override void PreInitialize()
        {
            Configuration.ReplaceService <IConnectionStringResolver, MyConnectionStringResolver>(); // using Abp.Configuration.Startup;

            if (!SkipDbContextRegistration)
            {
                Configuration.Modules.AbpEfCore().AddDbContext <SMICDbContext>(options =>
                {
                    if (options.ExistingConnection != null)
                    {
                        SMICDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
                    }
                    else
                    {
                        SMICDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
                    }
                });

                // Configure second DbContext
                Configuration.Modules.AbpEfCore().AddDbContext <SDIMDbContext>(options =>
                {
                    if (options.ExistingConnection != null)
                    {
                        SDIMDbContextOptionsConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
                    }
                    else
                    {
                        SDIMDbContextOptionsConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
                    }
                });
            }
        }
Ejemplo n.º 2
0
        public override void PreInitialize()
        {
            if (!SkipDbContextRegistration)
            {
                Configuration.Modules.AbpEfCore().AddDbContext <SMICDbContext>(options =>
                {
                    if (options.ExistingConnection != null)
                    {
                        SMICDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
                    }
                    else
                    {
                        SMICDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
                    }
                });

                // Configure second DbContext
                Configuration.Modules.AbpEfCore().AddDbContext <SDIMDbContext>(options =>
                {
                    if (options.ExistingConnection != null)
                    {
                        SDIMDbContextOptionsConfigurer.Configure(options.DbContextOptions, options.ExistingConnection);
                    }
                    else
                    {
                        SDIMDbContextOptionsConfigurer.Configure(options.DbContextOptions, options.ConnectionString);
                    }
                });
            }
        }
Ejemplo n.º 3
0
        public SMICDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <SMICDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder());

            SMICDbContextConfigurer.Configure(builder, configuration.GetConnectionString(SMICConsts.ConnectionStringName));

            return(new SMICDbContext(builder.Options));
        }