Open sandboxFocus

Property DefaultServiceLocator

DefaultServiceLocator

Gets or sets the delegate that returns DefaultService. By default, it returns a CachingService created by this class. Setting this property to null restores the default delegate.

Declaration
public static Func<ICachingService> DefaultServiceLocator { get; set; }
Property Value
Type Description
Func<ICachingService>
Remarks

The delegate is called by each call to a cached method that does not receive a service from dependency injection, so it must be fast and return the same instance every time, for instance a singleton resolved from a dependency injection container.

Set this property before configuring DefaultService, Profiles or the obsolete DefaultBackend and DefaultKeyBuilder properties: they configure the service returned at that time, and the configuration does not move to the service that a new delegate returns.

See Also