Esempio n. 1
0
        public static IDomainContext GetDomainContext()
        {
            var manifest = new SqlAggregateManifestRepository(SnapshotSourcedDB.Main);

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

            context.EventBus.Subscribe((x) => Console.WriteLine("domain bus event {0}", x));

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

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

            return(context);
        }
Esempio n. 2
0
        public static IDomainContext GetDomainContext()
        {
            KnownTypes.RegisterEvents(Assembly.GetExecutingAssembly());

            var manifest = new SqlAggregateManifestRepository(EventSourcedDB.Main);

            var eventStore = new EventStoreRepository(EventSourcedDB.Main);

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

            context.EventBus.Subscribe((x) => Console.WriteLine("domain bus event {0}", x));

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

            return(context);
        }