Пример #1
0
 public DropTable IncludeTable()
 {
     builder.DropTableHeaderText();
     TableIfExists(database.Name);
     builder.Begin();
     builder.AppendLine(string.Format(" DROP TABLE [{0}].[{1}]", scriptTable.Schema, scriptTable.Name));
     builder.AddEndGo();
     builder.NewLine();
     return(this);
 }
Пример #2
0
 public DropSp IncludeSp()
 {
     builder.UseDb(dbName);
     builder.Go();
     SpIfExists();
     builder.Begin();
     builder.AppendLine(string.Format("DROP PROCEDURE [{0}].[{1}]", schemaName, spName));
     builder.AddEndGo();
     return(this);
 }
Пример #3
0
        public CreateTable IncludeForeignKey()
        {
            builder.CreateForeignKeyConstraintHeaderText();
            Table scriptTable = GetTable();

            for (int i = 0; i < scriptTable.ForeignKeys.Count; i++)
            {
                builder.AppendLine(ScriptHelper.KeyIsNull(scriptTable.ForeignKeys[i].Name));

                builder.Begin();
                var foreignScripts = scriptTable.ForeignKeys[i].Script(options);
                foreach (string script in foreignScripts)
                {
                    builder.AppendLine(script);
                }

                builder.AddEndGo();
            }
            builder.NewLine();
            return(this);
        }
Пример #4
0
        public CreateSp IncludeSp()
        {
            builder.AppendLine(ScriptHelper.KeyIsNull(spName, "P"));
            builder.Begin();
            builder.AppendLine(string.Format(" EXEC ('CREATE PROCEDURE [{0}].[{1}] AS ')", schemaName, spName));
            builder.AddEndGo();
            var createScripts = database.StoredProcedures[spName, schemaName].Script(options);

            foreach (string script in createScripts)
            {
                builder.AppendLine(script);
            }

            builder.RemoveAnsiQuotedIdentifier();

            return(this);
        }