コード例 #1
0
 public void Setup()
 {
     this.BeforeSaveCalled = false;
     this.AfterSaveCalled  = false;
     context             = new TestDomainContext <SqlLiteDomain.SqlLiteDomain>(new SqlLiteDomain.SqlLiteDomain());
     context.BeforeSave += (sender, args) => this.BeforeSaveCalled = true;
     context.AfterSave  += (sender, args) => this.AfterSaveCalled = true;
 }
コード例 #2
0
ファイル: SnapshotSamples.cs プロジェクト: nagyist/MonoKit
        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;
        }
コード例 #3
0
ファイル: EventSourceSamples.cs プロジェクト: nagyist/MonoKit
        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;
        }