public SitecoreCachingConfigBuilder(ISitecoreServicesConfiguration sitecore) { Condition.Requires(sitecore, nameof(sitecore)).IsNotNull(); _sitecore = sitecore; TryConfigureCacheDefault(cache => cache); }
/// <summary> /// The configure commerce pipelines. /// </summary> /// <param name="services"> /// The sitecore services configuration. /// </param> /// <returns> /// The <see cref="ISitecoreServicesConfiguration"/>. /// </returns> public static ISitecoreServicesConfiguration ConfigureCommercePipelines(this ISitecoreServicesConfiguration services) { services.Pipelines(config => config .ConfigurePipeline <IPopulateValidateCartPipeline>(builder => builder .Add <ValidateCartCouponsBlock>().After <PopulateCartLineItemsBlock>()) .ConfigurePipeline <ICalculateCartLinesPipeline>(builder => builder .Add <CalculateCartLinesSubTotalsBlock>() .Add <CalculateCartLinesFulfillmentBlock>() .Add <CalculateCartLinesPromotionsBlock>() .Add <CalculateCartLinesTotalsBlock>()) .ConfigurePipeline <ICalculateCartPipeline>(builder => builder .Add <CalculateCartSubTotalsBlock>() .Add <CalculateCartFulfillmentBlock>() .Add <CalculateCartPromotionsBlock>() .Add <CalculateCartTotalsBlock>() .Add <CalculateCartPaymentsBlock>() .Add <WriteCartTotalsToContextBlock>()) .ConfigurePipeline <IAddPaymentsPipeline>(builder => builder.Add <ValidateCartHasFulfillmentBlock>().After <ValidateCartAndPaymentsBlock>())); return(services); }
public static ISitecoreServicesConfiguration Eventing(this ISitecoreServicesConfiguration builder, Action <SitecoreEventingConfigBuilder> configure = null) { builder.Services.TryAdd(ServiceDescriptor.Singleton <IEventRegistry, EventRegistry>()); configure?.Invoke(new SitecoreEventingConfigBuilder(builder)); return(builder); }
public static ISitecoreServicesConfiguration CachingWithMemoryDefaults( this ISitecoreServicesConfiguration builder, Action <MemoryCacheStoreOptions> configureStore = null, string defaultStoreName = "Memory-Default") { builder.Caching(config => config .AddMemoryStore(defaultStoreName, configureStore) .ConfigureCacheDefaults(defaultStoreName)); return(builder); }
public static ISitecoreServicesConfiguration ConfigureDoActionPipeline(this ISitecoreServicesConfiguration services) { services.Pipelines( config => config .ConfigurePipeline <IDoActionPipeline>(c => { c.Add <DoActionEditComponentBlock>().After <ValidateEntityVersionBlock>() .Add <DoActionAddValidationConstraintBlock>().Before <DoActionEditComponentBlock>(); }) ); return(services); }
public static ISitecoreServicesConfiguration ConfigureGetEntityViewPipeline(this ISitecoreServicesConfiguration services) { services.Pipelines( config => config .ConfigurePipeline <IGetEntityViewPipeline>(c => { c .Add <GetComponentViewBlock>().After <GetSellableItemDetailsViewBlock>() .Add <GetCatalogComponentConnectViewBlock>().After <GetComponentViewBlock>() .Add <GetCategoryComponentConnectViewBlock>().After <GetCatalogComponentConnectViewBlock>() .Add <GetSellableItemComponentConnectViewBlock>().After <GetCategoryComponentConnectViewBlock>(); }) ); return(services); }
/// <summary> /// Adds the Sitecore caching system to the service collection. Only to be called once per application. /// This function will setup a cache memory provider that will be used by all caches (by default) unless they are configured to use other providers. /// </summary> public static ISitecoreServicesConfiguration Caching(this ISitecoreServicesConfiguration builder, Action <SitecoreCachingConfigBuilder> configure = null) { builder.Services.AddMatchingOptions(); builder.Services.TryAdd(ServiceDescriptor.Singleton <ICacheManager, CacheManager>()); builder.Services.TryAdd(ServiceDescriptor.Singleton(typeof(ICache <>), typeof(Cache <>))); builder.Services.TryAdd(ServiceDescriptor.Singleton <ICacheStoreManager, CacheStoreManager>()); builder.Services.TryAdd(ServiceDescriptor.Singleton <ICacheFactory, CacheFactory>()); builder.Services.TryAddSingleton <ICacheStoreSerializer, DefaultCacheStoreSerializer>(); // Ensure default options are set if this is the first call in startup. builder.Services.TryAdd(ServiceDescriptor.Transient <IConfigureMatchingOptions <CacheOptions>, DefaultCacheOptionsSetup>()); var configBuilder = new SitecoreCachingConfigBuilder(builder); configure?.Invoke(configBuilder); return(builder); }
public void ConfigureServices(ISitecoreServicesConfiguration sitecore) { _logger.LogInformation("Configuring event defaults"); sitecore.Eventing(); }
public void ConfigureServices(ISitecoreServicesConfiguration sitecore) { sitecore.Caching(); }
public static ISitecoreServicesConfiguration AddGetApplicableViewConditionsPipeline(this ISitecoreServicesConfiguration services) { services.Pipelines( config => config. AddPipeline <IGetApplicableViewConditionsPipeline, GetApplicableViewConditionsPipeline>(c => { c.Add <ValidateSellableItemViewBlock>() .Add <ValidatePromotionViewBlock>() .Add <ValidateOrderViewBlock>() .Add <ValidateCustomerViewBlock>() .Add <ValidateInventorySetBlock>() .Add <ValidateCatalogViewBlock>() .Add <ValidatePromotionBookViewBlock>() .Add <ValidatePriceBookViewBlock>() .Add <ValidatePriceCardViewBlock>() .Add <ValidateCategoryViewBlock>(); }) ); return(services); }
public static ISitecoreServicesConfiguration ConfigurePopulateEntityViewActionsPipeline(this ISitecoreServicesConfiguration services) { services.Pipelines( config => config .ConfigurePipeline <IPopulateEntityViewActionsPipeline>(c => { c.Add <PopulateComponentActionsBlock>().After <InitializeEntityViewActionsBlock>(); }) ); return(services); }
public GetStackedPipelineConfigurationCommand(IServiceProvider serviceProvider, ISitecoreServicesConfiguration services) : base(serviceProvider) { this._serviceProvider = serviceProvider; this._serviceCollection = services; }
public void ConfigureServices(ISitecoreServicesConfiguration sitecore) { sitecore.CachingWithMemoryDefaults(); }
public SitecoreEventingConfigBuilder(ISitecoreServicesConfiguration sitecore) { Sitecore = sitecore; }
/// <summary> /// Adds the services diagnostics. /// </summary> /// <param name="builder">The builder.</param> /// <returns>A <see cref="ISitecoreServicesConfiguration"/></returns> public static ISitecoreServicesConfiguration AddServicesDiagnostics(this ISitecoreServicesConfiguration builder) { builder.Services.AddSitecoreServicesDiagnosticsPage(); return(builder); }
public static ISitecoreServicesConfiguration AddCacheDiagnostics(this ISitecoreServicesConfiguration builder) { builder.Services.AddSingleton <IDiagnosticPage, CacheDiagnosticsPage>(); return(builder); }