Class OptionalParameter
A ParameterValue that can be passed to RegisterType(Type, Type, string, ITypeLifetimeManager, params InjectionMember[]) to configure a parameter or property as an optional dependency.
public class OptionalParameter : ParameterBase, IEquatable<Type>, IResolverFactory<Type>, IResolverFactory<ParameterInfo>
- Inheritance
-
OptionalParameter
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
OptionalParameter()
Construct a new OptionalParameter instance that specifies to optionally resolve whatever Type specified at this position
public OptionalParameter()
OptionalParameter(string)
Construct a new OptionalParameter object that
specifies the given name
.
public OptionalParameter(string name)
Parameters
name
stringName for the dependency.
OptionalParameter(Type)
Construct a new OptionalParameter object that
specifies the given type
.
public OptionalParameter(Type type)
Parameters
type
TypeType of the dependency.
OptionalParameter(Type, string)
Construct a new OptionalParameter object that
specifies the given type
and name
.
public OptionalParameter(Type type, string name)
Parameters
Methods
GetResolver<TContext>(ParameterInfo)
public ResolveDelegate<TContext> GetResolver<TContext>(ParameterInfo info) where TContext : IResolveContext
Parameters
info
ParameterInfo
Returns
- ResolveDelegate<TContext>
Type Parameters
TContext
GetResolver<TContext>(Type)
public ResolveDelegate<TContext> GetResolver<TContext>(Type type) where TContext : IResolveContext
Parameters
type
Type
Returns
- ResolveDelegate<TContext>
Type Parameters
TContext