public AzureQueueStorageRepository(IRecorder recorder, string connectionString)
 {
     recorder.GuardAgainstNull(nameof(recorder));
     connectionString.GuardAgainstNullOrEmpty(nameof(connectionString));
     this.connectionString = connectionString;
     this.recorder         = recorder;
 }
예제 #2
0
 private SqlServerRepository(IRecorder recorder, string connectionString)
 {
     recorder.GuardAgainstNull(nameof(recorder));
     connectionString.GuardAgainstNullOrEmpty(nameof(connectionString));
     this.recorder         = recorder;
     this.connectionString = connectionString;
 }
예제 #3
0
 public GeneralQueueStorage(IRecorder recorder, IQueueository queueository)
 {
     recorder.GuardAgainstNull(nameof(recorder));
     queueository.GuardAgainstNull(nameof(queueository));
     this.recorder     = recorder;
     this.queueository = queueository;
     this.queueName    = typeof(TMessage).GetEntityNameSafe();
 }
        public GeneralReadModelStorage(IRecorder recorder, IRepository repository)
        {
            recorder.GuardAgainstNull(nameof(recorder));
            repository.GuardAgainstNull(nameof(repository));

            this.recorder   = recorder;
            this.repository = repository;
        }
예제 #5
0
 public GeneralCrudStorage(IRecorder recorder, IRepository repository)
 {
     recorder.GuardAgainstNull(nameof(recorder));
     repository.GuardAgainstNull(nameof(repository));
     this.recorder      = recorder;
     this.repository    = repository;
     this.containerName = typeof(TDto).GetEntityNameSafe();
 }
        public PersonEntityReadModelProjection(IRecorder recorder, IRepository repository)
        {
            recorder.GuardAgainstNull(nameof(recorder));
            repository.GuardAgainstNull(nameof(repository));

            this.recorder      = recorder;
            this.personStorage = new GeneralReadModelStorage <Person>(recorder, repository);
        }
예제 #7
0
        protected EventStreamHandlerBase(IRecorder recorder, params IEventNotifyingStorage[] eventingStorages)
        {
            recorder.GuardAgainstNull(nameof(recorder));
            eventingStorages.GuardAgainstNull(nameof(eventingStorages));

            this.recorder         = recorder;
            this.eventingStorages = eventingStorages;
            ProcessingErrors      = new List <EventProcessingError>();
        }
예제 #8
0
 public GeneralBlobStorage(IRecorder recorder, string containerName, IBlobository blobository)
 {
     recorder.GuardAgainstNull(nameof(recorder));
     blobository.GuardAgainstNull(nameof(blobository));
     containerName.GuardAgainstNull(nameof(containerName));
     this.recorder      = recorder;
     this.blobository   = blobository;
     this.containerName = containerName;
 }
        public CarEntityReadModelProjection(IRecorder recorder, IRepository repository)
        {
            recorder.GuardAgainstNull(nameof(recorder));
            repository.GuardAgainstNull(nameof(repository));

            this.recorder              = recorder;
            this.carStorage            = new GeneralReadModelStorage <Car>(recorder, repository);
            this.unavailabilityStorage = new GeneralReadModelStorage <Unavailability>(recorder, repository);
        }
예제 #10
0
 private AzureCosmosSqlApiRepository(IRecorder recorder, string connectionString, string databaseName)
 {
     recorder.GuardAgainstNull(nameof(recorder));
     connectionString.GuardAgainstNullOrEmpty(nameof(connectionString));
     databaseName.GuardAgainstNullOrEmpty(nameof(databaseName));
     this.recorder         = recorder;
     this.connectionString = connectionString;
     this.databaseName     = databaseName;
 }
예제 #11
0
 public InProcessChangeEventNotificationSubscription(IRecorder recorder,
                                                     IChangeEventMigrator migrator,
                                                     IEnumerable <IDomainEventPublisherSubscriberPair> pubSubPairs,
                                                     params IEventNotifyingStorage[] eventingStorages) : base(recorder, eventingStorages)
 {
     recorder.GuardAgainstNull(nameof(recorder));
     migrator.GuardAgainstNull(nameof(migrator));
     pubSubPairs.GuardAgainstNull(nameof(pubSubPairs));
     this.notificationProducer = new DomainEventNotificationProducer(recorder, migrator, pubSubPairs.ToArray());
 }
예제 #12
0
 public GeneralQueryStorage(IRecorder recorder, IDomainFactory domainFactory, IRepository repository)
 {
     recorder.GuardAgainstNull(nameof(recorder));
     repository.GuardAgainstNull(nameof(repository));
     domainFactory.GuardAgainstNull(nameof(domainFactory));
     this.recorder      = recorder;
     this.repository    = repository;
     this.domainFactory = domainFactory;
     this.containerName = typeof(TDto).GetEntityNameSafe();
 }
예제 #13
0
        public DomainEventNotificationProducer(IRecorder recorder, IChangeEventMigrator migrator,
                                               params IDomainEventPublisherSubscriberPair[] pubSubPairs)
        {
            recorder.GuardAgainstNull(nameof(recorder));
            pubSubPairs.GuardAgainstNull(nameof(pubSubPairs));
            migrator.GuardAgainstNull(nameof(migrator));

            this.recorder    = recorder;
            this.pubSubPairs = pubSubPairs;
            this.migrator    = migrator;
        }
예제 #14
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;
 }
 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;
 }
예제 #16
0
 public PersonsApplication(IRecorder recorder, IIdentifierFactory idFactory, IPersonStorage storage,
                           IEmailService emailService)
 {
     recorder.GuardAgainstNull(nameof(recorder));
     idFactory.GuardAgainstNull(nameof(idFactory));
     storage.GuardAgainstNull(nameof(storage));
     emailService.GuardAgainstNull(nameof(emailService));
     this.recorder     = recorder;
     this.idFactory    = idFactory;
     this.storage      = storage;
     this.emailService = emailService;
 }
 public GeneralEventStreamStorage(IRecorder recorder, IDomainFactory domainFactory,
                                  IChangeEventMigrator migrator, IRepository repository)
 {
     recorder.GuardAgainstNull(nameof(recorder));
     repository.GuardAgainstNull(nameof(repository));
     domainFactory.GuardAgainstNull(nameof(domainFactory));
     migrator.GuardAgainstNull(nameof(migrator));
     this.recorder      = recorder;
     this.repository    = repository;
     this.domainFactory = domainFactory;
     this.migrator      = migrator;
     this.containerName = typeof(TAggregateRoot).GetEntityNameSafe();
 }
예제 #18
0
        public static AzureCosmosSqlApiRepository FromSettings(IRecorder recorder, IAppSettings settings,
                                                               string databaseName)
        {
            settings.GuardAgainstNull(nameof(settings));
            recorder.GuardAgainstNull(nameof(recorder));
            databaseName.GuardAgainstNullOrEmpty(nameof(databaseName));

            var accountKey = settings.GetString("Storage:AzureCosmosDbAccountKey");
            var hostName   = settings.GetString("Storage:AzureCosmosDbHostName");
            var localEmulatorConnectionString = $"AccountEndpoint=https://{hostName}:8081/;AccountKey={accountKey}";

            return(new AzureCosmosSqlApiRepository(recorder, localEmulatorConnectionString, databaseName));
        }
예제 #19
0
        public CarStorage(IRecorder recorder, IDomainFactory domainFactory,
                          IEventStreamStorage <CarEntity> eventStreamStorage,
                          IRepository repository)
        {
            recorder.GuardAgainstNull(nameof(recorder));
            domainFactory.GuardAgainstNull(nameof(domainFactory));
            eventStreamStorage.GuardAgainstNull(nameof(eventStreamStorage));
            repository.GuardAgainstNull(nameof(repository));

            this.carQueryStorage              = new GeneralQueryStorage <Car>(recorder, domainFactory, repository);
            this.carEventStreamStorage        = eventStreamStorage;
            this.unavailabilitiesQueryStorage =
                new GeneralQueryStorage <Unavailability>(recorder, domainFactory, repository);
        }
예제 #20
0
        public ReadModelProjector(IRecorder recorder, IReadModelCheckpointStore checkpointStore,
                                  IChangeEventMigrator migrator,
                                  params IReadModelProjection[] projections)
        {
            recorder.GuardAgainstNull(nameof(recorder));
            checkpointStore.GuardAgainstNull(nameof(checkpointStore));
            projections.GuardAgainstNull(nameof(projections));
            migrator.GuardAgainstNull(nameof(migrator));

            this.recorder        = recorder;
            this.checkpointStore = checkpointStore;
            this.projections     = projections;
            this.migrator        = migrator;
        }
예제 #21
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;
        }
예제 #22
0
        public InProcessReadModelProjectionSubscription(IRecorder recorder, IIdentifierFactory idFactory,
                                                        IChangeEventMigrator migrator, IDomainFactory domainFactory, IRepository repository,
                                                        IEnumerable <IReadModelProjection> projections,
                                                        params IEventNotifyingStorage[] eventingStorages) : base(recorder, eventingStorages)
        {
            recorder.GuardAgainstNull(nameof(recorder));
            idFactory.GuardAgainstNull(nameof(idFactory));
            migrator.GuardAgainstNull(nameof(migrator));
            domainFactory.GuardAgainstNull(nameof(domainFactory));
            repository.GuardAgainstNull(nameof(repository));
            projections.GuardAgainstNull(nameof(projections));
            var checkpointReadModel = new ReadModelCheckpointStore(recorder, idFactory, domainFactory, repository);

            this.projector = new ReadModelProjector(recorder, checkpointReadModel, migrator, projections?.ToArray());
        }
예제 #23
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;
        }
예제 #24
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(IRecorder recorder, IIdentifierFactory idFactory, Identifier identifier)
        {
            recorder.GuardAgainstNull(nameof(recorder));
            idFactory.GuardAgainstNull(nameof(idFactory));
            identifier.GuardAgainstNull(nameof(identifier));
            Recorder             = recorder;
            IdFactory            = idFactory;
            Id                   = identifier;
            this.events          = new List <IChangeEvent>();
            this.isInstantiating = identifier == Identifier.Empty();

            var now = DateTime.UtcNow;

            LastPersistedAtUtc = null;
            IsDeleted          = null;
            CreatedAtUtc       = this.isInstantiating
                ? now
                : DateTime.MinValue;
            LastModifiedAtUtc = this.isInstantiating
                ? now
                : DateTime.MinValue;
            ChangeVersion = 0;
        }