Inheritance: INotifyPropertyChanged
 private void RegisterNewConnectionString(SqlConnectionString newValue)
 {
     if (newValue != null)
     {
         newValue.PropertyChanged += ConnectionStringPropertyChanged;
     }
 }
示例#2
0
        public List <string> GetDatabases(SqlConnectionString connectionString)
        {
            var databases = new List <string>();

            using (var conn = new SqlConnection(connectionString.WithDatabase("master")))
            {
                conn.Open();
                var serverConnection = new ServerConnection(conn);
                var server           = new Server(serverConnection);
                databases.AddRange(from Database database in server.Databases select database.Name);
            }

            return(databases);
        }
示例#3
0
 public List <DatabaseTable> GetTables(SqlConnectionString connectionString)
 {
     using (var conn = new SqlConnection(connectionString.WithDatabase("master")))
     {
         conn.Open();
         var serverConnection = new ServerConnection(conn);
         var server           = new Server(serverConnection);
         return
             (server
              .Databases[connectionString.Database]
              .Tables
              .Cast <Table>()
              .Select(t => new DatabaseTable
         {
             Name = t.Name,
             RowCount = t.RowCount
         })
              .ToList());
     }
 }
 public static void SetConnectionString(DependencyObject dp, SqlConnectionString value)
 {
     dp.SetValue(ConnectionStringProperty, value);
 }
 private void RegisterNewConnectionString(SqlConnectionString newValue)
 {
     if (newValue != null)
         newValue.PropertyChanged += ConnectionStringPropertyChanged;
 }
 public static void SetConnectionString(DependencyObject dp, SqlConnectionString value)
 {
     dp.SetValue(ConnectionStringProperty, value);
 }