Ejemplo n.º 1
0
        private void ExecuteBuildConfigurationSql(AppSettingContext context, BuildConfiguration buildConfiguration)
        {
            string sql = null;

            if (buildConfiguration == BuildConfiguration.Debug)
            {
                sql = this.GetType().Assembly.GetManifestResourceText(DbConstants.APPLICATION_CONTEXT_SEED_DEBUG_RESOURCE);
            }
            else
            {
                throw new DbUpdateException($"An error occured while seeding the database:\tCannot identify build configuration for connection string '{context.Database.Connection.ConnectionString}'.");
            }

            if (sql != null)
            {
                context.Database.ExecuteSqlCommand(sql);
            }
        }
Ejemplo n.º 2
0
        private void ExecuteSeedSql(AppSettingContext context)
        {
            var sql = this.GetType().Assembly.GetManifestResourceText(DbConstants.APPLICATION_CONTEXT_SEED_RESOURCE);

            context.Database.ExecuteSqlCommand(sql);
        }
 public RepositoryApplicationSettingsInitializer(AppSettingContext context)
     : base(context)
 {
 }