Ejemplo n.º 1
0
        public PaymentsApplication(ILogger logger, IIdentifierFactory idFactory, IPaymentStorage storage)
        {
            logger.GuardAgainstNull(nameof(logger));
            idFactory.GuardAgainstNull(nameof(idFactory));
            storage.GuardAgainstNull(nameof(storage));

            this.logger    = logger;
            this.idFactory = idFactory;
            this.storage   = storage;
        }
Ejemplo n.º 2
0
 public CarsApplication(IRecorder recorder, IIdentifierFactory idFactory, ICarStorage storage,
                        IPersonsService personsService)
 {
     recorder.GuardAgainstNull(nameof(recorder));
     idFactory.GuardAgainstNull(nameof(idFactory));
     storage.GuardAgainstNull(nameof(storage));
     personsService.GuardAgainstNull(nameof(personsService));
     this.recorder       = recorder;
     this.idFactory      = idFactory;
     this.storage        = storage;
     this.personsService = personsService;
 }
Ejemplo n.º 3
0
 public ClinicsApplication(ILogger logger, IIdentifierFactory idFactory, IClinicStorage storage,
                           IPersonsService personsService)
 {
     logger.GuardAgainstNull(nameof(logger));
     idFactory.GuardAgainstNull(nameof(idFactory));
     storage.GuardAgainstNull(nameof(storage));
     personsService.GuardAgainstNull(nameof(personsService));
     this.logger         = logger;
     this.idFactory      = idFactory;
     this.storage        = storage;
     this.personsService = personsService;
 }
Ejemplo n.º 4
0
 public PersonsApplication(ILogger logger, IIdentifierFactory idFactory, IPersonStorage storage,
                           IEmailService emailService)
 {
     logger.GuardAgainstNull(nameof(logger));
     idFactory.GuardAgainstNull(nameof(idFactory));
     storage.GuardAgainstNull(nameof(storage));
     emailService.GuardAgainstNull(nameof(emailService));
     this.logger       = logger;
     this.idFactory    = idFactory;
     this.storage      = storage;
     this.emailService = emailService;
 }
 public ReadModelCheckpointStore(IRecorder recorder, IIdentifierFactory idFactory,
                                 IDomainFactory domainFactory, IRepository repository)
 {
     recorder.GuardAgainstNull(nameof(recorder));
     idFactory.GuardAgainstNull(nameof(idFactory));
     repository.GuardAgainstNull(nameof(repository));
     domainFactory.GuardAgainstNull(nameof(domainFactory));
     this.recorder      = recorder;
     this.idFactory     = idFactory;
     this.repository    = repository;
     this.domainFactory = domainFactory;
 }
Ejemplo n.º 6
0
        public AppointmentsApplication(ILogger logger, IIdentifierFactory idFactory, IAppointmentStorage storage,
                                       IClinicsService clinicsService)
        {
            logger.GuardAgainstNull(nameof(logger));
            idFactory.GuardAgainstNull(nameof(idFactory));
            storage.GuardAgainstNull(nameof(storage));
            clinicsService.GuardAgainstNull(nameof(clinicsService));

            this.logger         = logger;
            this.idFactory      = idFactory;
            this.storage        = storage;
            this.clinicsService = clinicsService;
        }
Ejemplo n.º 7
0
        protected EntityBase(ILogger logger, IIdentifierFactory idFactory)
        {
            logger.GuardAgainstNull(nameof(logger));
            idFactory.GuardAgainstNull(nameof(idFactory));
            Logger    = logger;
            IdFactory = idFactory;
            Id        = idFactory.Create(this);

            var now = DateTime.UtcNow;

            LastPersistedAtUtc = null;
            CreatedAtUtc       = now;
            LastModifiedAtUtc  = now;
        }
Ejemplo n.º 8
0
        public InProcessReadModelProjectionSubscription(ILogger logger, IIdentifierFactory idFactory,
                                                        IChangeEventMigrator migrator, IDomainFactory domainFactory, IRepository repository,
                                                        IEnumerable <IReadModelProjection> projections,
                                                        params IEventNotifyingStorage[] eventingStorages) : base(logger, eventingStorages)
        {
            logger.GuardAgainstNull(nameof(logger));
            idFactory.GuardAgainstNull(nameof(idFactory));
            migrator.GuardAgainstNull(nameof(migrator));
            domainFactory.GuardAgainstNull(nameof(domainFactory));
            repository.GuardAgainstNull(nameof(repository));
            projections.GuardAgainstNull(nameof(projections));
            var checkpointReadModel = new ReadModelCheckpointStore(logger, idFactory, domainFactory, repository);

            this.projector = new ReadModelProjector(logger, checkpointReadModel, migrator, projections?.ToArray());
        }
Ejemplo n.º 9
0
        protected EntityBase(IRecorder recorder, IIdentifierFactory idFactory)
        {
            recorder.GuardAgainstNull(nameof(recorder));
            idFactory.GuardAgainstNull(nameof(idFactory));
            Recorder  = recorder;
            IdFactory = idFactory;
            Id        = idFactory.Create(this);

            var now = DateTime.UtcNow;

            LastPersistedAtUtc = null;
            IsDeleted          = null;
            CreatedAtUtc       = now;
            LastModifiedAtUtc  = now;
        }
Ejemplo n.º 10
0
        private PersistableEntityBase(IRecorder recorder, IIdentifierFactory idFactory, Identifier identifier)
        {
            recorder.GuardAgainstNull(nameof(recorder));
            idFactory.GuardAgainstNull(nameof(idFactory));
            identifier.GuardAgainstNull(nameof(identifier));
            Recorder  = recorder;
            IdFactory = idFactory;
            Id        = identifier;

            var isInstantiating = identifier == Identifier.Empty();
            var now             = DateTime.UtcNow;

            LastPersistedAtUtc = null;
            CreatedAtUtc       = isInstantiating
                ? now
                : DateTime.MinValue;
            LastModifiedAtUtc = isInstantiating
                ? now
                : DateTime.MinValue;
        }
Ejemplo n.º 11
0
        /// <summary>
        ///     Creates a new instance of the aggregate with the specified <see cref="Identifier" />,
        ///     used during persistence instantiation. Does not raise any create event.
        /// </summary>
        protected AggregateRootBase(ILogger logger, IIdentifierFactory idFactory, Identifier identifier)
        {
            logger.GuardAgainstNull(nameof(logger));
            idFactory.GuardAgainstNull(nameof(idFactory));
            identifier.GuardAgainstNull(nameof(identifier));
            Logger               = logger;
            IdFactory            = idFactory;
            Id                   = identifier;
            this.events          = new List <IChangeEvent>();
            this.isInstantiating = identifier == Identifier.Empty();

            var now = DateTime.UtcNow;

            LastPersistedAtUtc = null;
            CreatedAtUtc       = this.isInstantiating
                ? now
                : DateTime.MinValue;
            LastModifiedAtUtc = this.isInstantiating
                ? now
                : DateTime.MinValue;
            ChangeVersion = 0;
        }
Ejemplo n.º 12
0
        public void SetIdentifier(IIdentifierFactory factory)
        {
            factory.GuardAgainstNull(nameof(factory));

            Id = factory.Create(this);
        }