/// <summary>
        /// Hooks the given profiler into core operations, allowing for recording relevant execution times
        /// </summary>
        public static void AddProfiler(this OptionsConfigurationBuilder builder, IProfiler profiler)
        {
            var operationProfiler = new OperationProfiler(profiler);

            builder.Decorate <IEventStore>(c => new EventStoreDecorator(c.Get <IEventStore>(), operationProfiler));
            builder.Decorate <IAggregateRootRepository>(c => new AggregateRootRepositoryDecorator(c.Get <IAggregateRootRepository>(), operationProfiler));
            builder.Decorate <IEventDispatcher>(c => new EventDispatcherDecorator(c.Get <IEventDispatcher>(), operationProfiler));
        }
Пример #2
0
        /// <summary>
        /// Enables aggregate root snapshotting. When enabled, aggregate roots can be snapped by applying a <see cref="EnableSnapshotsAttribute"/> to them,
        /// using the <see cref="EnableSnapshotsAttribute.Version"/> property to leave old snapshots behind.
        /// </summary>
        public static void EnableSnapshotting(this OptionsConfigurationBuilder builder, Action <SnapshottingConfigurationBuilder> configureSnapshotting)
        {
            var snapshottingConfigurationBuilder = new SnapshottingConfigurationBuilder(builder);

            configureSnapshotting(snapshottingConfigurationBuilder);

            builder.Decorate <IAggregateRootRepository>((inner, ctx) =>
            {
                var eventStore            = ctx.GetService <IEventStore>();
                var domainEventSerializer = ctx.GetService <IDomainEventSerializer>();
                var snapshotStore         = ctx.GetService <ISnapshotStore>();

                var threshold = snapshottingConfigurationBuilder.PreparationThreshold;

                return(new NewSnapshottingAggregateRootRepositoryDecorator(inner, eventStore, domainEventSerializer, snapshotStore, threshold));
            });
        }
Пример #3
0
        internal SnapshottingConfigurationBuilder(OptionsConfigurationBuilder optionsConfigurationBuilder)
        {
            _optionsConfigurationBuilder = optionsConfigurationBuilder;

            PreparationThreshold = TimeSpan.FromSeconds(0.5);
        }
        internal SnapshottingConfigurationBuilder(OptionsConfigurationBuilder optionsConfigurationBuilder)
        {
            _optionsConfigurationBuilder = optionsConfigurationBuilder;

            PreparationThreshold = TimeSpan.FromSeconds(0.5);
        }
 /// <summary>
 /// Configures the TestContext to not wait for views to catch up
 /// </summary>
 public static void Asynchronous(this OptionsConfigurationBuilder builder)
 {
     builder.RegisterInstance <Action <TestContext> >(o => o.Asynchronous = true, multi: true);
 }