Exemplo n.º 1
0
        // Aggregate-Specific Behaviors (Methods) Below

        public void InitIfNeeded(TrustedSystemId id)
        {
            if (_aggState.Id == null)
            {
                Create(id);
            }
        }
Exemplo n.º 2
0
 bool CanHandle(TrustedSystemId system)
 {
     if (_model == null)
     {
         return(false);
     }
     if (system.Id != _model.Id.Id)
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 3
0
        void InitApplication(AppInit obj)
        {
            _uiBus.Publish(obj);

            UpdateProfile(profile =>
            {
                profile.InitIfNeeded();
                _currentSystem = profile.GetCurrentSystemId();
            });
            UpdateDomain(system => system.InitIfNeeded(_currentSystem));

            // Publish the event that "ProfileLoaded" which
            // ClientModelController is one of the subsribers to.

            _queue.Enqueue(new ProfileLoaded(_currentSystem));
        }
Exemplo n.º 4
0
        // lifetime change management
        // atomic consistency boundary of an Aggregate & its contents
        void ChangeAgg(TrustedSystemId withAggIdOf, Action <TrustedSystemAggregate> usingThisMethod)
        {
            var eventStreamId = withAggIdOf.Id.ToString();
            var eventStream   = _eventStore.LoadEventStream(eventStreamId);

            var aggStateBeforeChanges = TrustedSystemState.BuildStateFromEventHistory(eventStream.Events);

            var aggToChange = new TrustedSystemAggregate(aggStateBeforeChanges);

            // HACK
            if (eventStream.Events.Count == 0)
            {
                aggToChange.Create(withAggIdOf);
            }

            usingThisMethod(aggToChange);

            _eventStore.AppendEventsToStream(eventStreamId, eventStream.StreamVersion, aggToChange.EventsCausingChanges);
        }
Exemplo n.º 5
0
 public ClientModel(IMessageQueue queue, TrustedSystemId id)
 {
     _queue = queue;
     Id = id;
 }
 public void Create(TrustedSystemId id)
 {
     Apply(new TrustedSystemCreated(id));
 }
Exemplo n.º 7
0
 public StuffTrashed(TrustedSystemId id, StuffId stuffId, DateTime timeUtc)
 {
     Id = id;
     StuffId = stuffId;
     TimeUtc = timeUtc;
 }
Exemplo n.º 8
0
 public void When(ClientProfileSwitchedToTrustedSystem e)
 {
     CurrentSystem = e.Id;
 }
Exemplo n.º 9
0
 public DeferActionUntil(TrustedSystemId id, ActionId actionId, DateTime deferUntil)
 {
     Id = id;
     ActionId = actionId;
     DeferUntil = deferUntil;
 }
Exemplo n.º 10
0
 public ClientModel(IMessageQueue queue, TrustedSystemId id)
 {
     _queue = queue;
     Id     = id;
 }
Exemplo n.º 11
0
 public ActionDueDateMoved(TrustedSystemId id, ActionId actionId, DateTime oldDueDate, DateTime newDueDate)
 {
     Id = id;
     ActionId = actionId;
     OldDueDate = oldDueDate;
     NewDueDate = newDueDate;
 }
Exemplo n.º 12
0
 public ClientProfileSwitchedToTrustedSystem(TrustedSystemId id)
 {
     Id = id;
 }
Exemplo n.º 13
0
 public ActionDeferDateShifted(TrustedSystemId id, ActionId actionId, DateTime oldDeferDate, DateTime newDeferDate)
 {
     Id = id;
     ActionId = actionId;
     OldDeferDate = oldDeferDate;
     NewDeferDate = newDeferDate;
 }
Exemplo n.º 14
0
 public ActionDefined(TrustedSystemId id, ActionId actionId, ProjectId projectId, string outcome, DateTime timeUtc)
 {
     Id = id;
     ActionId = actionId;
     ProjectId = projectId;
     Outcome = outcome;
     TimeUtc = timeUtc;
 }
Exemplo n.º 15
0
 public TrustedSystemCreated(TrustedSystemId id)
 {
     Id = id;
 }
Exemplo n.º 16
0
 public ActionAssignedToProject(TrustedSystemId id, ActionId actionId, ProjectId newProject, DateTime timeUtc)
 {
     Id = id;
     ActionId = actionId;
     NewProject = newProject;
     TimeUtc = timeUtc;
 }
Exemplo n.º 17
0
 public TrashStuff(TrustedSystemId id, StuffId stuffId)
 {
     Id = id;
     StuffId = stuffId;
 }
Exemplo n.º 18
0
 public ProfileLoaded(TrustedSystemId systemId)
 {
     SystemId = systemId;
 }
Exemplo n.º 19
0
 public ActionIsNoLongerDeferred(TrustedSystemId id, ActionId actionId, DateTime oldDeferDate)
 {
     Id = id;
     ActionId = actionId;
     OldDeferDate = oldDeferDate;
 }
Exemplo n.º 20
0
 public void Create(TrustedSystemId id)
 {
 }
Exemplo n.º 21
0
        // When methods reacting to Events to change in-memory state of the Aggregate

        public void When(TrustedSystemCreated e)
        {
            Id = e.Id;
        }
Exemplo n.º 22
0
 public CompleteAction(TrustedSystemId id, ActionId actionId)
 {
     Id = id;
     ActionId = actionId;
 }
Exemplo n.º 23
0
 public StuffDescriptionChanged(TrustedSystemId id, StuffId stuffId, string newDescriptionOfStuff, DateTime timeUtc)
 {
     Id = id;
     StuffId = stuffId;
     NewDescriptionOfStuff = newDescriptionOfStuff;
     TimeUtc = timeUtc;
 }
Exemplo n.º 24
0
 public DefineAction(TrustedSystemId id, RequestId requestId, ProjectId projectId, string outcome)
 {
     Id = id;
     RequestId = requestId;
     ProjectId = projectId;
     Outcome = outcome;
 }
Exemplo n.º 25
0
 // When methods reacting to Events to change in-memory state of the Aggregate
 public void When(TrustedSystemCreated e)
 {
     Id = e.Id;
 }
Exemplo n.º 26
0
 public ActionMovedToProject(TrustedSystemId id, ActionId actionId, ProjectId oldProject, ProjectId newProject, DateTime timeUtc)
 {
     Id = id;
     ActionId = actionId;
     OldProject = oldProject;
     NewProject = newProject;
     TimeUtc = timeUtc;
 }
Exemplo n.º 27
0
 public StuffPutInInbox(TrustedSystemId id, StuffId stuffId, string stuffDescription, DateTime timeUtc)
 {
     Id = id;
     StuffId = stuffId;
     StuffDescription = stuffDescription;
     TimeUtc = timeUtc;
 }
Exemplo n.º 28
0
 public void When(ClientProfileSwitchedToTrustedSystem e)
 {
     CurrentSystem = e.Id;
 }
Exemplo n.º 29
0
 public ActionOutcomeChanged(TrustedSystemId id, ActionId actionId, ProjectId projectId, string actionOutcome, DateTime timeUtc)
 {
     Id = id;
     ActionId = actionId;
     ProjectId = projectId;
     ActionOutcome = actionOutcome;
     TimeUtc = timeUtc;
 }
Exemplo n.º 30
0
 public void Create(TrustedSystemId id)
 {
     Apply(new TrustedSystemCreated(id));
 }
Exemplo n.º 31
0
 public ActionRemovedFromProject(TrustedSystemId id, ActionId actionId, ProjectId oldProject, DateTime timeUtc)
 {
     Id = id;
     ActionId = actionId;
     OldProject = oldProject;
     TimeUtc = timeUtc;
 }
Exemplo n.º 32
0
 public ArchiveAction(TrustedSystemId id, ActionId actionId)
 {
     Id = id;
     ActionId = actionId;
 }
Exemplo n.º 33
0
 public ChangeActionOutcome(TrustedSystemId id, ActionId actionId, string outcome)
 {
     Id = id;
     ActionId = actionId;
     Outcome = outcome;
 }
Exemplo n.º 34
0
 public void Verify(TrustedSystemId id)
 {
 }
Exemplo n.º 35
0
 public ChangeProjectOutcome(TrustedSystemId id, ProjectId projectId, string outcome)
 {
     Id = id;
     ProjectId = projectId;
     Outcome = outcome;
 }
Exemplo n.º 36
0
 public void Create(TrustedSystemId id)
 {
 }
Exemplo n.º 37
0
 public ChangeProjectType(TrustedSystemId id, ProjectId projectId, ProjectType type)
 {
     Id = id;
     ProjectId = projectId;
     Type = type;
 }
Exemplo n.º 38
0
 // Aggregate-Specific Behaviors (Methods) Below
 public void InitIfNeeded(TrustedSystemId id)
 {
     if (_aggState.Id == null)
     {
         Create(id);
     }
 }
Exemplo n.º 39
0
 public ChangeStuffDescription(TrustedSystemId id, StuffId stuffId, string newDescriptionOfStuff)
 {
     Id = id;
     StuffId = stuffId;
     NewDescriptionOfStuff = newDescriptionOfStuff;
 }
Exemplo n.º 40
0
 public ProfileLoaded(TrustedSystemId trustedSystemId)
 {
     TrustedSystemId = trustedSystemId;
 }
Exemplo n.º 41
0
 public void Verify(TrustedSystemId id)
 {
 }