I\'m trying to implement a simple CQRS-application example.
This is a structure of my \"Command\" part:
public interface ICommand
{
}
//base interfa
Assuming you have ConcreteCommand : IComman and ConcreteCommandHandler : ICommandHandler use RegisterType method like this:
builder.RegisterType()
.As>();
And then inject your handler:
private ICommandHandler concreteCommandHandler;
Also look at the automatic assembly types registration Autofac abilities.
If you'd like to resolve ICommandHandler by ICommand implementation then factory registration can help. Register Func or define special class that will resolve appropriate command handler.