Exemplo n.º 1
0
 private void LoadColumnsAndPrimaryKey(Table table)
 {
     using (var cnn = new SqlConnection(connectionString))
     {
         var da = new TableDataAccess(cnn);
         table.Columns = da.LoadColumns(table.TableName, table.Schema);
         da.PopulatePrimaryKey(table);
     }
 }
Exemplo n.º 2
0
        public void EnsureFullyPopulated(string connectionString)
        {
            if (Columns != null && ForeignKeys != null)
            {
                return;
            }

            using (var cnn = new SqlConnection(connectionString))
            {
                var da = new TableDataAccess(cnn);
                if (Columns == null)
                {
                    Columns = da.LoadColumns(TableName, Schema);
                    da.PopulatePrimaryKey(this);
                }
                if (ForeignKeys == null)
                {
                    da.PopulateForeignKeys(this);
                }
            }
        }