internal static IServiceCollection AddSnapshotStorageBasedLogConsistencyProvider(
            this IServiceCollection services,
            Func <SnapshotStrategyInfo, bool> snapshotStrategy,
            string name)
        {
            services
            .AddSingletonNamedService(name, (sp, n) => LogConsistencyProviderFactory.Create(sp, n, snapshotStrategy))
            .TryAddSingleton(sp => sp.GetServiceByName <ILogViewAdaptorFactory>(ProviderConstants.DEFAULT_STORAGE_PROVIDER_NAME));

            return(services);
        }
Пример #2
0
        internal static IServiceCollection AddSnapshotStorageBasedLogConsistencyProvider(
            this IServiceCollection services,
            SnapshotStorageOptions options,
            string name)
        {
            services.AddSnapshotStorageLogConsistencyOptions(options.UseIndependentEventStorage, name);

            if (options.UseIndependentEventStorage)
            {
                options.ConfigureIndependentEventStorage?.Invoke(services, name);
            }

            services
            .AddSingletonNamedService(name, (sp, n) => LogConsistencyProviderFactory.Create(sp, n, options.SnapshotStrategy))
            .TryAddSingleton(sp => sp.GetServiceByName <ILogViewAdaptorFactory>(ProviderConstants.DEFAULT_STORAGE_PROVIDER_NAME));

            return(services);
        }