ContravariantRegistrationSource Class |
Namespace: Autofac.Features.Variance
The ContravariantRegistrationSource type exposes the following members.
Name | Description | |
---|---|---|
ContravariantRegistrationSource | Initializes a new instance of the ContravariantRegistrationSource class |
Name | Description | |
---|---|---|
IsAdapterForIndividualComponents |
Gets a value indicating whether the registrations provided by this source are 1:1 adapters on top
of other components (e.g., Meta, Func, or Owned).
|
Name | Description | |
---|---|---|
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
RegistrationsFor |
Retrieve registrations for an unregistered service, to be used
by the container.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
interface IHandler<in TCommand> { void Handle(TCommand command); } class Command { } class DerivedCommand : Command { } class CommandHandler : IHandler<Command> { ... } var builder = new ContainerBuilder(); builder.RegisterSource(new ContravariantRegistrationSource()); builder.RegisterType<CommandHandler>(); var container = builder.Build(); // Source enables this line, even though IHandler<Command> is the // actual registered type. var handler = container.Resolve<IHandler<DerivedCommand>>(); handler.Handle(new DerivedCommand());