Class DI
General helper methods for dependency injection containers that are used by entities to create behaviors.
Inheritance
Inherited Members
Namespace: SpiceSharp.Entities.DependencyInjection
Assembly: SpiceSharp.dll
Syntax
public static class DI
Properties
ScanIfNotFound
If true, then all loaded assemblies are searched for behaviors the first time that behaviors are
created.
Declaration
public static bool ScanIfNotFound { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
Methods
Get<TEntity, TContext>()
Gets the behavior resolver for the specified entity and binding context types.
Declaration
public static IBehaviorResolver<TContext> Get<TEntity, TContext>()
where TEntity : IEntity<TContext> where TContext : IBindingContext
Returns
| Type | Description |
|---|---|
| IBehaviorResolver<TContext> |
Type Parameters
| Name | Description |
|---|---|
| TEntity | The type of the entity. |
| TContext | The type of the context. |
RegisterAllBehaviors(Assembly)
Registers all behaviors in the specified assembly.
Declaration
public static void RegisterAllBehaviors(Assembly assembly)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Reflection.Assembly | assembly | The assembly. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | Thrown if |
RegisterBehaviorFor<TEntity, TTarget, TBehavior>(Int32)
Registers a behavior for the specified entity.
Declaration
public static void RegisterBehaviorFor<TEntity, TTarget, TBehavior>(int priority)
where TEntity : IEntity where TTarget : IBehavior where TBehavior : TTarget
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | priority | The priority of the behavior. |
Type Parameters
| Name | Description |
|---|---|
| TEntity | The type of the entity. |
| TTarget | The type of the target. |
| TBehavior | The type of the behavior. |
Resolve(ISimulation, IEntity, IBehaviorContainer)
Resolves behaviors for the specified simulation and entity.
Declaration
public static void Resolve(ISimulation simulation, IEntity entity, IBehaviorContainer behaviors)
Parameters
| Type | Name | Description |
|---|---|---|
| ISimulation | simulation | The simulation. |
| IEntity | entity | The entity. |
| IBehaviorContainer | behaviors | The behaviors. |
Resolve<TContext>(ISimulation, IEntity, IBehaviorContainer, TContext)
Resolves behaviors for the specified simulation and entity.
Declaration
public static void Resolve<TContext>(ISimulation simulation, IEntity entity, IBehaviorContainer behaviors, TContext context)
where TContext : IBindingContext
Parameters
| Type | Name | Description |
|---|---|---|
| ISimulation | simulation | The simulation. |
| IEntity | entity | The entity. |
| IBehaviorContainer | behaviors | The behaviors. |
| TContext | context | The context. |
Type Parameters
| Name | Description |
|---|---|
| TContext | The type of the context. |