public MainWindow() { InitializeComponent(); CurrentPersistable = new Persistable { Fields = new ObservableCollection<Field> {new Field {Name = "Test", Type = "string"}}, Tables = new ObservableCollection<DbTable> { new DbTable { Name = "Test", Columns = new ObservableCollection<DbColumn> { new DbColumn {Name = "Test"} } }, new DbTable { Name = "Test2", Columns = new ObservableCollection<DbColumn> { new DbColumn { Name = "Test2"}, new DbColumn { Name = "Test3"} } } } }; foreach (var tbl in CurrentPersistable.Tables) { tbl.PrimaryKey = tbl.Columns.First(); } DataContext = CurrentPersistable; }
public PersistableClass(Persistable persistable) { Namespace = persistable.Namespace; Name = persistable.Name; Properties = persistable.Fields.Select(x => new Property(x)).ToList(); }