Open sandboxFocus

Method WithService

WithService(TBase, 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)
Parameters
Type Name Description
TBase service
bool allowOverride
Returns
Type Description
ServiceProvider<TBase>

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

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