예제 #1
0
        public static IDomainContext GetDomainContext()
        {
            var domainBus = new ObservableDomainEventBus();
            domainBus.Subscribe((x) => Console.WriteLine("domain bus event {0}", x));

            var manifest = new SqlAggregateManifestRepository(SnapshotSourcedDB.Main);

            var context = new TestDomainContext(SnapshotSourcedDB.Main, manifest, null, domainBus);

            // registrations
            context.RegisterSnapshot<SnapshotTestRoot>(c => new SnapshotRepository<TestSnapshot>(SnapshotSourcedDB.Main));

            context.RegisterBuilder<SnapshotTestRoot>((c, b) =>
                 new TransactionReadModelBuilder(new SqlRepository<TransactionDataContract>(SnapshotSourcedDB.Main)));

            return context;
        }
예제 #2
0
        public static IDomainContext GetDomainContext()
        {
            KnownTypes.RegisterEvents(Assembly.GetExecutingAssembly());

            var manifest = new SqlAggregateManifestRepository(EventSourcedDB.Main);

            var eventStore = new EventStoreRepository(EventSourcedDB.Main);

            var domainBus = new ObservableDomainEventBus();
            domainBus.Subscribe((x) => Console.WriteLine("domain bus event {0}", x));

            var context = new TestDomainContext(EventSourcedDB.Main, manifest, eventStore, domainBus);

            // registrations
            context.RegisterBuilder<EventSourcedRoot>((c, b) =>
                 new TransactionReadModelBuilder(new SqlRepository<TransactionDataContract>(EventSourcedDB.Main)));

            return context;
        }