Beispiel #1
0
        public PingTest()
        {
            _loggerMoq = new Mock <ILoggerFactory>(MockBehavior.Loose);

            _dbContext = new EventSourcingDbContext(new DbContextOptionsBuilder <EventSourcingDbContext>()
                                                    .UseInMemoryDatabase(nameof(EventSourcingDbContext))
                                                    .Options);
            _eventSourcingLedger      = new PingEventSourcingLedgerAdapter(_loggerMoq.Object, _dbContext);
            _eventSourcingLedgerQuery = new PingEventSourcingLedgerAdapter(_loggerMoq.Object, _dbContext);
        }
        private EventStorePatientEndSchedulingService SetupEventEndService()
        {
            EventDataSeeder dataSeeder = new EventDataSeeder();
            DbContextOptionsBuilder <EventSourcingDbContext> builder = new DbContextOptionsBuilder <EventSourcingDbContext>();;
            DbContextOptions <EventSourcingDbContext>        options;
            EventSourcingDbContext context;

            builder.UseInMemoryDatabase(Guid.NewGuid().ToString());
            options = builder.Options;
            context = new EventSourcingDbContext(options);

            dataSeeder.SeedAll(context);

            var eventRepo = new DomainEventRepository <PatientEndSchedulingEvent>(context);

            return(new EventStorePatientEndSchedulingService(eventRepo));
        }
        public MapEventsTests()
        {
            EventDataSeeder dataSeeder = new EventDataSeeder();
            DbContextOptionsBuilder <EventSourcingDbContext> builder = new DbContextOptionsBuilder <EventSourcingDbContext>();;
            DbContextOptions <EventSourcingDbContext>        options;
            EventSourcingDbContext context;

            builder.UseInMemoryDatabase(Guid.NewGuid().ToString());
            options = builder.Options;
            context = new EventSourcingDbContext(options);

            dataSeeder.SeedAll(context);

            var buildingEventRepo = new DomainEventRepository <BuildingSelectionEvent>(context);

            buildingEventService = new BuildingSelectionService(buildingEventRepo);
            var floorChangeEventRepo = new DomainEventRepository <FloorChangeEvent>(context);

            floorChangeEventService = new FloorChangeService(floorChangeEventRepo);
            var roomEventRepo = new DomainEventRepository <RoomSelectionEvent>(context);

            roomEventService = new RoomSelectionService(roomEventRepo);
        }
        public async Task Post([FromServices] IEventSourcingService eventSourcingService, [FromServices] EventSourcingDbContext dbContext, [FromBody] string value, CancellationToken cancellationToken)
        {
            using (var transaction = await dbContext.Database.BeginTransactionAsync(cancellationToken))
            {
                await eventSourcingService.SaveEventLogAsync(new MessageTest(Guid.NewGuid().ToString()) { Testando = value }, transaction);

                transaction.Commit();
            }

            //eventBus.Publish<MessageTest>(new MessageTest(Guid.NewGuid().ToString()) { Testando = value });
        }
Beispiel #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="loggerFactory"></param>
 /// <param name="dbContext"></param>
 /// <param name="serviceFilter">default value null, query regardless sender service.</param>
 public EventSourcingLedger(ILoggerFactory loggerFactory, EventSourcingDbContext dbContext, string serviceFilter = null) : base(loggerFactory, dbContext)
 {
     _serviceFilter = serviceFilter;
 }
Beispiel #6
0
 public Repository()
 {
     _context = new EventSourcingDbContext();
 }
Beispiel #7
0
 public TrackingEventSourcingLedgerAdapter(ILoggerFactory loggerFactory, EventSourcingDbContext dbContext)
 {
     _pingEventSourcingLedger = new EventSourcingLedger(loggerFactory, dbContext, Identifiers.TrackingServiceName);
 }
 public DomainEventRepository(EventSourcingDbContext context)
 {
     _context = context;
 }
 public BaseEventSourcingLedger(ILoggerFactory loggerFactory, EventSourcingDbContext dbContext)
 {
     _logger    = loggerFactory.CreateLogger(typeof(BaseEventSourcingLedger));
     _dbContext = dbContext;
 }