Interface ISimulationContainer
Assembly: Mars.Interfaces.dll
Syntax
public interface ISimulationContainer : IDisposable
Methods
Register<TService, TServiceImpl>(String, Type[])
Registers a concrete type implementing the provided interface type where the concrete
object has a single lifetime scope of ths simulation container.
A name can be used to register the instance by name and to resolve the dependency by that.
Declaration
void Register<TService, TServiceImpl>(string name = null, Type[] withParameterTypes = null)
Parameters
Type |
Name |
Description |
System.String |
name |
The optional name as key |
Type[] |
withParameterTypes |
The optional set of parameter type, used
to select a concrete constructor according to the signature.
|
Type Parameters
Name |
Description |
TService |
The interface type which will be implemented |
TServiceImpl |
The concrete type implementing the |
RegisterInstance<TService>(Object, String)
Registers a concrete component implementation for the whole application which can lazy be resolved from each
other component within the application.
Declaration
void RegisterInstance<TService>(object instance, string name = null)
where TService : class
Parameters
Type |
Name |
Description |
System.Object |
instance |
The concrete instance to register at the dependency container |
System.String |
name |
The optional name used to retrieve the component implementation |
Type Parameters
Name |
Description |
TService |
The interface type for public access |
Resolve<TService>()
Resolves and returns an implementation of a passed interfaces from the runtime system
Declaration
TService Resolve<TService>()
where TService : class
Returns
Type |
Description |
TService |
A concrete implementation of this interface |
Type Parameters
Name |
Description |
TService |
The service to get |
Resolve<TService>(String)
Resolves and returns an implementation of a passed interfaces fro the runtime system
Declaration
TService Resolve<TService>(string name)
where TService : class
Parameters
Type |
Name |
Description |
System.String |
name |
|
Returns
Type |
Description |
TService |
A concrete implementation of this interface |
Type Parameters
Name |
Description |
TService |
The service to get |
TryResolve<TService>(out TService)
Try to retrieve a service from the context.
Declaration
bool TryResolve<TService>(out TService instance)
where TService : class
Parameters
Type |
Name |
Description |
TService |
instance |
The resulting component instance providing the service, or default(T). |
Returns
Type |
Description |
System.Boolean |
True if a component providing the service is available.
|
Type Parameters
Name |
Description |
TService |
The service type to resolve. |
TryResolve<TService>(String, out TService)
Try to retrieve a service from the context.
Declaration
bool TryResolve<TService>(string name, out TService instance)
where TService : class
Parameters
Type |
Name |
Description |
System.String |
name |
The name associated to this component or service. |
TService |
instance |
The output resolved component instance of this call. |
Returns
Type |
Description |
System.Boolean |
True if a component providing the service is available.
|
Type Parameters
Name |
Description |
TService |
The service type to resolve. |