public static MongoDbHeraPersistence UsingMongoDbPersistence(this HeraPersistence hera, MongoDbPersistenceOptions options)
        {
            hera.Builder.RegisterInstance(new MongoDbEventStore(options)).As <IEventStore>().SingleInstance();
            hera.Builder.RegisterInstance(new MongoDbSnapshotStore(options)).As <ISnapshotStore>().SingleInstance();

            // TODO: Move on the proper place
            hera.Builder.RegisterType <DefaultCommitNotifier>().As <ICommitNotifier>().SingleInstance();
            hera.Builder.RegisterType <DefaultEventPublisher>().As <IEventPublisher>().SingleInstance();

            return(new MongoDbHeraPersistence(hera));
        }
Exemplo n.º 2
0
        public static HeraPersistence UsingInMemoryPersistence(this HeraPersistence hera)
        {
            hera.Builder.RegisterType <InMemoryEventStore>().As <IEventStore>().SingleInstance();
            hera.Builder.RegisterType <InMemorySnapshotStore>().As <ISnapshotStore>().SingleInstance();


            // TODO: Move somewhere else. This is not the right place.
            hera.Builder.RegisterType <DefaultCommitNotifier>().As <ICommitNotifier>().SingleInstance();
            hera.Builder.RegisterType <DefaultEventPublisher>().As <IEventPublisher>().SingleInstance();

            return(new HeraPersistence(hera));
        }
Exemplo n.º 3
0
        public static HeraSerialization UsingBinarySerialization(this HeraPersistence hera)
        {
            hera.Builder.RegisterType <BinarySerializer>().As <ISerialize>().InstancePerLifetimeScope();

            return(new HeraSerialization(hera));
        }