我知道您可以在创建LifetimeScope 时添加注册,如下所示:
using(var scope = container.BeginLifetimeScope(builder =>
{ builder.RegisterType<Override>().As<IService>();
builder.RegisterModule<MyModule>();
}))
{
// The additional registrations will be available
// only in this lifetime scope.
}
创建后是否可以添加注册LifetimeScope?using(例如在块内添加注册)