コード例 #1
0
 /// <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());
 }
コード例 #2
0
 public static SqlConnection Create(SqlConnectionStringBuilder builder, string database = null)
 {
     return(new SqlConnection(builder.Clone().SetInitialCatalog(database).ToString()));
 }