5
dll로 표시된 가장 욕심 많은 생성자를 찾으려면 Autofac을 사용하려고합니다.가장 욕심 많은 생성자를 찾지 못하는 Autofac
그것은 찾지 못하고 오직 하나의 매개 변수없는 생성자 만 찾습니다. 너무 복잡
var builder = new ContainerBuilder();
builder.RegisterType<SampleMvcAutoAuthenticationCallbackProvider>().As<IAuthenticationCallbackProvider>();
builder.RegisterControllers(typeof(MvcApplication).Assembly);
builder.RegisterControllers(typeof(SimpleAuthenticationController).Assembly);
var container = builder.Build();
DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
아무것도 : 나는 autofac
와 함께 물건을 등록하지 어떻게 지금이이
public SimpleAuthenticationController() { .. }
public SimpleAuthenticationController(IAuthenticationCallbackProvider callbackProvider) : this()
:
이
두 ctors 있습니다.그러나 이것은 내가 생각할 수있는 유일한 이상한 것입니다.
typeof(MvcApplication)
내가 수동으로AddReferences
를 통해 추가 된 -seperate- DLL에서 발견된다global.asax
typeof(MvcApplication)
에서이 코드에 존재하는 동일한 프로젝트입니다.
누구나 내가 뭘 잘못했는지 알아?
매개 변수없는 생성자를 일시적으로 주석 처리하면 어떻게됩니까? 다른 매개 변수를 사용하여 성공적으로 해결합니까? –
확인해 보겠습니다. .. –
을 확인하십시오. 매개 변수없는 ctor가 주석 처리 된 상태로 잘 작동합니다. –