Esempio n. 1
0
    public async Task ReCreate()
    {
        var synonym = new Synonym(SqlConnection, SqlConnection.Database);
        await synonym.DropAll();

        await synonym.Create("mySynonym1", "target");

        await synonym.Create("mySynonym1", "target2");

        await Verifier.Verify(SqlConnection)
        .SchemaSettings(tables: false)
        .AddScrubber(builder => builder.Replace(SqlConnection.Database, "TargetDb"));
    }
Esempio n. 2
0
    public async Task DropAll()
    {
        var synonym = new Synonym(SqlConnection, SqlConnection.Database);
        await synonym.Create("mySynonym3", "target");

        await synonym.DropAll();

        await Verifier.Verify(SqlConnection)
        .SchemaSettings(tables: false);
    }
Esempio n. 3
0
        public void CreateOrReplaceSynonym(string synonymName, string srcDbName, string sourceName)
        {
            var synonym = SmoDatabase.Synonyms[synonymName];

            if (synonym != null)
            {
                synonym.Drop();
            }
            synonym = new Synonym(SmoDatabase, synonymName)
            {
                BaseDatabase = srcDbName,
                BaseSchema   = "dbo",
                BaseObject   = sourceName
            };
            synonym.Create();
        }