public EntityBase ResolveGeneric(BudgetModel model) { var entity = model.FindEntity(this); ReferencedEntity = entity; return(entity); }
public void LastEventInformation_IsAvailableOnReplay() { string lastEventId = Account.LastEventID; Account accountCopy = BudgetModel.FindEntity <Account>(Account.EntityID); Assert.That(accountCopy.LastEventID, Is.EqualTo(lastEventId)); bool vectorEqual = Account.LastEventVector.CompareVectors(accountCopy.LastEventVector) == Infrastructure.VectorClock.ComparisonResult.Equal; Assert.That(vectorEqual, Is.True); Account.Name = "Change The Name"; BudgetModel.SaveChanges(); Assert.That(Account.LastEventID, Is.Not.EqualTo(lastEventId)); Assert.That(Account.LastEventID, Is.EqualTo(TestEvents[0].EventID.ToString())); Assert.That(Account.LastEventID, Is.EqualTo(accountCopy.LastEventID)); }
public TransactionGridViewModel(BudgetModel model, string accountId) { _model = model; _account = _model.FindEntity <Account>(accountId); if (_account == null) { throw new ArgumentException("Cannot find Account in BudgetModel", nameof(accountId)); } //Load collections for use in Payee/Category lookup _budget = _account.GetParentBudget(); _budget.Accounts.LoadCollection(); _budget.MasterCategories.LoadCollection(); _budget.Payees.LoadCollection(); InitializeCommands(); _selectedRows = new ObservableCollection <TransactionGridRowViewModel>(); _selectedRows.CollectionChanged += SelectedRows_CollectionChanged; InitializeColumns(); InitializeGrid(_account); }