public EntitySchemaViewModel(EntitySchemaCollection srcCollection, EntitySchema schema) { Attributes = new ObservableCollection<ItemInfoKVP>(); this.Schema = schema; this.EntityType = schema.EntityType; this.Category = schema.Category; this.SupportedEntities = new ObservableCollection<string>(); foreach ( var se in schema.SupportedEntityTypes ) { SupportedEntities.Add(se); } foreach ( var kvp in schema.Attributes ) { ItemInfoKVP item = new ItemInfoKVP() { Key = kvp.Key, Value = kvp.Value}; Attributes.Add(item); item.OnItemEndEdit += item_OnItemEndEdit; item.PropertyChanged += item_PropertyChanged; item.PropertyChanging += item_PropertyChanging; } Attributes.CollectionChanged += Attributes_CollectionChanged; }
ItemInfoKVP(ItemInfoKVP kvp) { Key = this.Key; Value = new SchemaItemInfo() { AllowNull = kvp.Value.AllowNull, DefaultValue = kvp.Value.DefaultValue, IsReadonly = kvp.Value.IsReadonly, TypeName = kvp.Value.TypeName }; }