在Ninject中我有:
kernel.Bind<IDomainEventHandler<WinnerSelectedEvent>>()
.To<WinnerSelectedHandler>();
Autofac与此相当的是什么?
答案 0 :(得分:2)
Autofac相当于Ninject的:
kernel.Bind<Type>().To<Impl>();
时:
builder.RegisterType<Impl>().As<Type>();
所以相应的应该是:
var builder = new ContainerBuilder();
builder.RegisterType<WinnerSelectedHandler>().As<IDomainEventHandler<WinnerSelectedEvent>>();
var container = builder.Build();