Autofac vs Ninject contextual binding?
问题 1) Autofac and Ninject, which one is better in contextual binding? 2) With Ninject, I can bind to types in a specific namespace: Bind<A>().To<B>().When(context => context.ParentContext.Binding.Service.Namespace == "MyProject.Common"); Can I do this with Autofac? Thanks! (sorry for my English) 回答1: Of the two, only Ninject provides this functionality. It is a useful feature but Autofac excludes it to prevent fragility in other Autofac-specific features that rely on the dependency being unaware