Method | Description | |
---|---|---|
Add ( |
Registers a service associated to a callback (and an optional callback that will be called when the service will be removed). The serviceInstance is called as long as no service has been obtained (serviceInstance returns null). Once the actual service has been obtained, it is kept and serviceInstance is not called anymore.
|
|
Add ( |
Registers a service with its implementation (and an optional callback that will be called when the service will be removed).
|
|
AddDisabled ( |
Disables a service: null will always be returned by this IServiceProvider.GetService regardless of any fallbacks from BaseProvider. Direct services returned by GetDirectService can not be disabled. This is not the same as calling Add(Type,Func{Object},Action{Object}) with a null instance. A null instance for a service (a callback that always returns null) is nearly the same as calling Remove: any fallbacks (to a base IServiceProvider for example) can occur. This is stronger since this must prevent fallbacks. |
|
Clear ( ) : ISimpleServiceContainer |
Unregisters all the services. Any "on remove" actions are executed.
|
|
Dispose ( ) : void |
Disposing calls Clear to unregister all services. Any "on remove" actions are executed.
|
|
GetService ( |
Implements IServiceProvider.GetService.
|
|
Remove ( |
Unregisters a service. Can be called even if the service does not exist. The service is first removed and then the OnRemove associated action is called if it exists.
|
|
SimpleServiceContainer ( ) : System |
Initializes a new SimpleServiceContainer.
|
|
SimpleServiceContainer ( IServiceProvider baseProvider ) : System |
Initializes a new SimpleServiceContainer with a BaseProvider.
|
Method | Description | |
---|---|---|
Dispose ( bool disposing ) : void |
When disposing is true, calls Clear to unregister all services. Any "on remove" actions are executed. Whether Dispose() has been called.
|
|
GetDirectService ( |
Must return built-in services if any. These services take precedence over any registered services. This base implementation returns this object for IServiceProvider and ISimpleServiceContainer.
|
Method | Description | |
---|---|---|
DoAdd ( |
Correct ArgumentException throw by a Dictionary when adding an existing key.
|
public Add ( |
||
serviceType | Service type to register. It must not already exist in this container otherwise an exception is thrown. | |
serviceInstance | Func |
Delegate to call when needed. Can not be null. |
onRemove | Action |
Optional action that will be called whenever |
return | ISimpleServiceContainer |
public Add ( |
||
serviceType | Service type to register. It must not already exist in this container otherwise an exception is thrown. | |
serviceInstance | object | Implementation of the service. Can not be null. |
onRemove | Action |
Optional action that will be called whenever |
return | ISimpleServiceContainer |
public AddDisabled ( |
||
serviceType | Service type to disable. It must not already exist in this container otherwise an exception is thrown. | |
return | ISimpleServiceContainer |
protected GetDirectService ( |
||
serviceType | Type of the service to obtain. | |
return | object |
public GetService ( |
||
serviceType | Type of the service to obtain. | |
return | object |
public Remove ( |
||
serviceType | Service type to unregister. | |
return | ISimpleServiceContainer |
public SimpleServiceContainer ( IServiceProvider baseProvider ) : System | ||
baseProvider | IServiceProvider | Base |
return | System |