internal void ReceiveMessage(DirtyData message) { switch (message.Operation) { case OperationType.Add: if (!DirtyEntities.Contains(message.Source)) { DirtyEntities.Add(message.Source); RaisePropertyChanged(nameof(IsConsistentState)); } break; case OperationType.Remove: if (DirtyEntities.Contains(message.Source)) { DirtyEntities.Remove(message.Source); RaisePropertyChanged(nameof(IsConsistentState)); } break; default: throw new ArgumentException(ErrorMessages.UnexpectedType.GetDescription(), nameof(message.Operation)); } }
internal async Task SaveDirtyEntitiesAsync() { foreach (var entity in DirtyEntities.ToArray()) { if (entity.CanAcceptChanges()) { await entity.AcceptChanges(); } } }