Show / Hide Table of Contents

Class DI.Resolver<TContext>

The dependency injection container that is used by entities to create behaviors.

Inheritance
System.Object
DI.Resolver<TContext>
Implements
IBehaviorResolver<TContext>
IBehaviorResolver
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: SpiceSharp.Entities.DependencyInjection
Assembly: SpiceSharp.dll
Syntax
protected class Resolver<TContext> : IBehaviorResolver<TContext>, IBehaviorResolver where TContext : IBindingContext
Type Parameters
Name Description
TContext

Constructors

Resolver()

Declaration
public Resolver()

Methods

Clear()

Clears any strategies.

Declaration
public void Clear()

RegisterAfter<TBehavior>(Func<TContext, IBehavior>)

Registers a behavior factory for the specified target behavior after any previously defined factories.

Declaration
public IBehaviorResolver<TContext> RegisterAfter<TBehavior>(Func<TContext, IBehavior> factory)
    where TBehavior : IBehavior
Parameters
Type Name Description
System.Func<TContext, IBehavior> factory

The factory.

Returns
Type Description
IBehaviorResolver<TContext>

The IBehaviorResolver<TContext> for chaining.

Type Parameters
Name Description
TBehavior

The target behavior.

Exceptions
Type Condition
System.ArgumentNullException

Thrown if factory is null.

RegisterAfter<TBehavior, TBehaviorImpl>()

Registers a behavior factory for the specified target behavior after any previously defined factories.

Declaration
public IBehaviorResolver<TContext> RegisterAfter<TBehavior, TBehaviorImpl>()
    where TBehavior : IBehavior where TBehaviorImpl : TBehavior, IBehavior
Returns
Type Description
IBehaviorResolver<TContext>

The IBehaviorResolver<TContext> for chaining.

Type Parameters
Name Description
TBehavior

The target behavior.

TBehaviorImpl

The behavior implementation.

RegisterBefore<TBehavior>(Func<TContext, IBehavior>)

Registers a behavior factory for the specified target behavior before any previously defined factories.

Declaration
public IBehaviorResolver<TContext> RegisterBefore<TBehavior>(Func<TContext, IBehavior> factory)
    where TBehavior : IBehavior
Parameters
Type Name Description
System.Func<TContext, IBehavior> factory

The factory.

Returns
Type Description
IBehaviorResolver<TContext>

The IBehaviorResolver<TContext> for chaining.

Type Parameters
Name Description
TBehavior

The target behavior.

Exceptions
Type Condition
System.ArgumentNullException

Thrown if factory is null.

RegisterBefore<TBehavior, TBehaviorImpl>()

Registers a behavior factory for the specified target behavior before any previously defined factories.

Declaration
public IBehaviorResolver<TContext> RegisterBefore<TBehavior, TBehaviorImpl>()
    where TBehavior : IBehavior where TBehaviorImpl : TBehavior, IBehavior
Returns
Type Description
IBehaviorResolver<TContext>

The IBehaviorResolver<TContext> for chaining.

Type Parameters
Name Description
TBehavior

The target behavior.

TBehaviorImpl

The behavior implementation.

Resolve(ISimulation, IBehaviorContainer, TContext)

Resolves behaviors in the container for the specified simulation and context.

Declaration
public void Resolve(ISimulation simulation, IBehaviorContainer container, TContext context)
Parameters
Type Name Description
ISimulation simulation

The simulation.

IBehaviorContainer container

The container.

TContext context

The context.

Resolve(ISimulation, IEntity, IBehaviorContainer)

Creates behaviors in the container for the specified simulation and entity.

Declaration
public void Resolve(ISimulation simulation, IEntity entity, IBehaviorContainer container)
Parameters
Type Name Description
ISimulation simulation

The simulation.

IEntity entity

The entity.

IBehaviorContainer container

The behavior container.

Explicit Interface Implementations

IBehaviorResolver.RegisterAfter(Type, Type)

Registers a behavior factory for the specified target behavior after any previously defined factories.

Declaration
IBehaviorResolver IBehaviorResolver.RegisterAfter(Type behavior, Type behaviorImplementation)
Parameters
Type Name Description
System.Type behavior

The behavior.

System.Type behaviorImplementation

The behavior implementation.

Returns
Type Description
IBehaviorResolver

The IBehaviorResolver for chaining.

IBehaviorResolver.RegisterBefore(Type, Type)

Registers a behavior factory for the specified target behavior before any previously defined factories.

Declaration
IBehaviorResolver IBehaviorResolver.RegisterBefore(Type behavior, Type behaviorImplementation)
Parameters
Type Name Description
System.Type behavior

The behavior.

System.Type behaviorImplementation

The behavior implementation.

Returns
Type Description
IBehaviorResolver

The IBehaviorResolver for chaining.

Implements

IBehaviorResolver<TContext>
IBehaviorResolver

Extension Methods

Utility.ThrowIfNull<T>(T, String)

See Also

IBehaviorResolver<TContext>
Back to top Generated by DocFX