/// <summary> /// Возваращает все скрипты для указанной позиции и языка в генерации /// </summary> /// <param name="dialect"></param> /// <param name="mode"></param> /// <param name="position"></param> /// <returns></returns> public IEnumerable <SqlScript> GetScripts(DbDialect dialect, ScriptMode mode, ScriptPosition position) { if (GenerationOptions.Supports(SqlObjectType.Script)) { return(ExtendedScripts.SelectMany(_ => _.GetRealScripts(dialect, position, mode))); } return(new SqlScript[] {}); }
private void SetupDefaultScripts() { if (GenerationOptions.IncludeDialect.HasFlag(DbDialect.SqlServer) && GenerationOptions.GenerateCreateScript) { if (GenerationOptions.Supports(SqlObjectType.FileGroup)) { ExtendedScripts.Add(new SqlScript { Name = "sys:support_for_filegroups_begin", Mode = ScriptMode.Create, DbDialect = DbDialect.SqlServer, Position = ScriptPosition.Before, Text = DefaultScripts.SqlServerCreatePeramble }); ExtendedScripts.Add(new SqlScript { Name = "sys:support_for_filegroups_end", Mode = ScriptMode.Create, DbDialect = DbDialect.SqlServer, Position = ScriptPosition.After, Text = DefaultScripts.SqlServerCreateFinisher }); } } if (GenerationOptions.IncludeDialect.HasFlag(DbDialect.PostGres)) { ExtendedScripts.Add(new SqlScript { Name = "sys:psql_start", Mode = ScriptMode.Create, DbDialect = DbDialect.PostGres, Position = ScriptPosition.Before, Text = DefaultScripts.PostgresqlPeramble }); ExtendedScripts.Add(new SqlScript { Name = "sys:psql_end", Mode = ScriptMode.Create, DbDialect = DbDialect.PostGres, Position = ScriptPosition.After, Text = DefaultScripts.PostgresqlFinisher }); ExtendedScripts.Add(new SqlScript { Name = "sys:psql_start", Mode = ScriptMode.Drop, DbDialect = DbDialect.PostGres, Position = ScriptPosition.Before, Text = DefaultScripts.PostgresqlPeramble }); ExtendedScripts.Add(new SqlScript { Name = "sys:psql_end", Mode = ScriptMode.Drop, DbDialect = DbDialect.PostGres, Position = ScriptPosition.After, Text = DefaultScripts.PostgresqlFinisher }); } }