Esempio n. 1
0
        public Task Handle(NewProjectCommand command)
        {
            var timestamp = DateTimeOffset.UtcNow;
            var started = new ProjectStarted {Name = command.Name, Timestamp = timestamp};

            var tasks = command.Tasks
                .Select(name => new TaskRecorded {Timestamp = timestamp, Title = name});


            _session.Events.StartStream(command.ProjectId, started);
            _session.Events.Append(command.ProjectId, tasks);

            return _session.SaveChangesAsync();
        }
Esempio n. 2
0
 public Project(ProjectStarted started)
 {
     Version     = 1;
     Name        = started.Name;
     StartedTime = started.Timestamp;
 }