public virtual async Task RemoveEntityAsync(IEntity entity) { _entities.Remove(entity); if (EntitiesChanged != null) { await EntitiesChanged.Invoke(this, Entities); } }
public void RemoveEntity(Entity entity) { entities.Remove(entity); entity.EntitySet = null; EntitiesChanged.RaiseDeletionEventEx(this, entity); RaisePropertyChanged("Entities"); }
public virtual void AddEntity(Entity entity) { if (entities.Contains(entity)) { return; } entities.Add(entity); entity.EntitySet = this; RaisePropertyChanged("Entities"); EntitiesChanged.RaiseAdditionEventEx(this, entity); }
void OnEntitiesChanged(object sender, CollectionChangeEvent <Entity> e) { EntitiesChanged.RaiseEvent(entities, e); if (e.ChangeType == CollectionChangeAction.Addition) { SetupEventSubscriptions(e.ChangedObject); } else if (e.ChangeType == CollectionChangeAction.Deletion) { RemoveEventSubscriptions(e.ChangedObject); } }
public virtual void DeleteEntity(Entity entity) { foreach (var reference in entity.DirectedReferences) { reference.ToEntity.RemoveReference(reference.Reference); RemoveReference(reference.Reference); } entity.ClearReferences(); if (MappingSet != null) { MappingSet.DeleteEntity(entity); } if (entity.Parent != null) { entity.Parent.RemoveChild(entity); } for (int childCounter = entity.Children.Count - 1; childCounter >= 0; childCounter--) { Entity childEntity = entity.Children[childCounter]; entity.RemoveChild(childEntity); // Add the ID property back to the child entity for (int i = childEntity.Key.Properties.ToList().Count - 1; i >= 0; i--) { if (childEntity.Properties.Count(p => p == childEntity.Key.Properties.ElementAt(i)) == 0) { childEntity.AddProperty(childEntity.Key.Properties.ElementAt(i)); } } // Add any hidden properties back to the child foreach (var hiddenProperty in childEntity.PropertiesHiddenByAbstractParent) { hiddenProperty.IsHiddenByAbstractParent = false; } } RemoveEntity(entity); EntitiesChanged.RaiseDeletionEventEx(this, entity); RaisePropertyChanged("Entities"); }
protected void InvokeEntitiesChanged(IEnumerable <T> entities) { EntitiesChanged?.Invoke(entities); }
public virtual void OnEntitiesChanged(DependencyPropertyChangedEventArgs e) { EntitiesChanged?.Invoke(this, isListUserInteraction, e.OldValue, e.NewValue); }
/// <summary> /// Causes flushing entites to file and rising EntitiesChanged event. /// </summary> public void OnEntitesChanged() { EntitiesChanged?.Invoke(); }