Exemplo n.º 1
0
        public PALMASoftDbContext CreateDbContext(string[] args)
        {
            var builder       = new DbContextOptionsBuilder <PALMASoftDbContext>();
            var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder(), addUserSecrets: true);

            PALMASoftDbContextConfigurer.Configure(builder, configuration.GetConnectionString(PALMASoftConsts.ConnectionStringName));

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

            // Uncomment below line to write change logs for the entities below:
            //Configuration.EntityHistory.Selectors.Add("PALMASoftEntities", EntityHistoryHelper.TrackedTypes);
            //Configuration.CustomConfigProviders.Add(new EntityHistoryConfigProvider(Configuration));
        }