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")); }
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); }
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(); }