/// <summary> /// Creates a new instance of <see cref="SqlConnectionStringBuilder"/> with <see cref="SqlConnectionStringBuilder.InitialCatalog"/> set to "master" /// </summary> /// <param name="builder"></param> /// <returns></returns> public static SqlConnectionStringBuilder CloneForMaster(this SqlConnectionStringBuilder builder) { return(builder?.Clone().SetInitialCatalogToMaster()); }
public static SqlConnection Create(SqlConnectionStringBuilder builder, string database = null) { return(new SqlConnection(builder.Clone().SetInitialCatalog(database).ToString())); }