MVC3 응용 프로그램의 새 AppStart 폴더에 클래스 호출 NinjectMVC3을 추가하는 NuGet을 통한 Ninject의 최신 버전으로 알아 냈습니다.
I가 사용되는 코드이므로 folows : 자동 생성 NinjectMVC3.cs CreateKernel() 메소드 -
I는 RegisterServices의 다양한 주입 대상을 Ninject에 최대 유선
private static IKernel CreateKernel()
{
// Wire it up with AOP
NinjectAopConfiguration.NinjectAopConfigure();
//var kernel = new StandardKernel(); // Removed
RegisterServices(NinjectAopConfiguration._container.Kernel);
return NinjectAopConfiguration._container.Kernel;
}
() 메소드.
다음은 내가 MVC 3 응용 프로그램에 SNAP.Ninject을 추가 NinjectAOP.cs 이름을 변경하는 경우 NuGet에 의해 생성 된 샘플 코드를 가져다가 같이 만든 : 나는 또한을 할 필요가
public static class NinjectAopConfiguration
{
public readonly static NinjectAspectContainer _container;
static NinjectAopConfiguration()
{
_container = new NinjectAspectContainer();
}
public static void NinjectAopConfigure()
{
SnapConfiguration.For(_container).Configure(c =>
{
c.IncludeNamespace("MyNamespace.Model.*");
c.Bind<ExceptionLoggingInterceptor>().To<ExceptionLoggingAttribute>();
});
}
}
Ninject에 대한 어셈블리 바인딩 리디렉션은 다음과 같습니다. Ninject 어딘가에 어셈블리 버전 충돌이 있기 때문입니다.
이 정보가 도움이되기를 바랍니다.
나는 누군가에게 외모를 갖도록 권유하고 그들이 이것을 향상시킬 수 있는지 확인합니다.