Exemplo n.º 1
0
        public ActivityProjector(
            IDbService dbService,
            IPersistStreams persistStreams,
            IEntryService entryService,
            IUserService userService,
            ILogger <ActivityProjector> logger,
            IOptions <Configuration> applicationConfiguration) : base(persistStreams, dbService)
        {
            var conventionalDispatcher = new ConventionBasedEventDispatcher(c => Checkpoint = c.ToSome(), commit => {
                logger.LogWarning($"Commit contains null events. CommitId:{commit.CommitId}, CommitSequence:{commit.CommitSequence}, StreamId:{commit.StreamId}, StreamRevision:{commit.StreamRevision}, EventCount:{commit.Events.Count}, AggregateId {commit.AggregateId()}");
            })
                                         .FirstProject <EntryCreated>(OnEntryCreated)
                                         .ThenProject <EntryUpdated>(OnEntryUpdated)
                                         .ThenProject <EntryRemoved>(OnEntryRemoved)
                                         .ThenProject <PlacementCreated>(OnPlacementCreated)
                                         .ThenProject <PlacementUpdated>(OnPlacementUpdated)
                                         .ThenProject <PlacementRemoved>(OnPlacementRemoved)
                                         .ThenProject <SkillSelfAssessmentCreated>(OnSelfAssessmentCreated)
                                         .ThenProject <SkillSelfAssessmentUpdated>(OnSelfAssessmentUpdated)
                                         .ThenProject <SkillSelfAssessmentRemoved>(OnSelfAssessmentRemoved)
                                         .ThenProject <EntryShared>(OnEntryShared)
                                         .ThenProject <EntryCollaboratorRemoved>(OnEntryCollaboratorRemoved)
                                         .ThenProject <EntryCommentCreated>(OnEntryCommentCreated);

            _conventionProjector      = new ConventionBasedCommitProjecter(this, dbService, conventionalDispatcher);
            _entryService             = entryService;
            _userService              = userService;
            _applicationConfiguration = applicationConfiguration;
        }
Exemplo n.º 2
0
        public SelfAssessmentProjector(IDbService dbService, IPersistStreams persistStreams, ILogger <SelfAssessmentProjector> logger) : base(persistStreams, dbService)
        {
            var conventionalDispatcher = new ConventionBasedEventDispatcher(c => Checkpoint = c.ToSome(), commit => {
                logger.LogWarning($"Commit contains null events. CommitId:{commit.CommitId}, CommitSequence:{commit.CommitSequence}, StreamId:{commit.StreamId}, StreamRevision:{commit.StreamRevision}, EventCount:{commit.Events.Count}, AggregateId {commit.AggregateId()}");
            })
                                         .FirstProject <SkillSelfAssessmentCreated>(CreateSelfAssessment)
                                         .ThenProject <SkillSelfAssessmentUpdated>(UpdateSelfAssessment)
                                         .ThenProject <SkillSelfAssessmentRemoved>(RemoveSelfAssessment);

            _conventionProjector = new ConventionBasedCommitProjecter(this, dbService, conventionalDispatcher);
        }
Exemplo n.º 3
0
        public PlacementProjector(IDbService dbService, IPersistStreams persistStreams, ILogger <PlacementProjector> logger) : base(persistStreams, dbService)
        {
            var conventionalDispatcher = new ConventionBasedEventDispatcher(c => Checkpoint = c.ToSome(), commit => {
                logger.LogWarning($"Commit contains null events. CommitId:{commit.CommitId}, CommitSequence:{commit.CommitSequence}, StreamId:{commit.StreamId}, StreamRevision:{commit.StreamRevision}, EventCount:{commit.Events.Count}, AggregateId {commit.AggregateId()}");
            })
                                         .FirstProject <PlacementCreated>(OnPlacementCreated)
                                         .ThenProject <PlacementUpdated>(OnPlacementUpdated)
                                         .ThenProject <PlacementRemoved>(OnPlacementRemoved)
                                         .ThenProject <EntryCreated>(OnEntryCreated)
                                         .ThenProject <EntryCreatedWithType>(OnEntryCreatedWithType)
                                         .ThenProject <EntryUpdated>(OnEntryUpdated)
                                         .ThenProject <EntryRemoved>(OnEntryRemoved)
                                         .ThenProject <EntryShared>(OnEntryShared)
                                         .ThenProject <EntryCollaboratorRemoved>(OnEntryCollaboratorRemoved);

            _conventionProjector = new ConventionBasedCommitProjecter(this, dbService, conventionalDispatcher);
            _logger = logger;
        }