Open sandboxFocus

Method WithService

WithService(TBase, bool, bool)

Returns a new ServiceProvider<TBase> where a service have been added to the current ServiceProvider<TBase>. If the new service is already present in the current ServiceProvider<TBase>, it is replaced in the new ServiceProvider<TBase>.

Declaration
public ServiceProvider<TBase> WithService(TBase service, bool allowOverride = false, bool disableCaching = false)
Parameters
Type Name Description
TBase service
bool allowOverride
bool disableCaching
Returns
Type Description
ServiceProvider<TBase>

WithService<T>(Func<ServiceProvider<TBase>, T>, bool, bool)

Declaration
public ServiceProvider<TBase> WithService<T>(Func<ServiceProvider<TBase>, T> func, bool allowOverride = false, bool disableCaching = false) where T : class, TBase
Parameters
Type Name Description
Func<ServiceProvider<TBase>, T> func
bool allowOverride
bool disableCaching
Returns
Type Description
ServiceProvider<TBase>
Type Parameters
Name Description
T