내 문제가 있습니다. 내 앱에 여러 프로젝트가 있습니다.mvc3의 Ninject 도움말!
- WEB (컨트롤러 및 뷰)
- 서비스
- 데이터 (edmx 및 저장소)
- 엔티티 (POCO)
- 테스트
그래서 내 웹 프로젝트에서 내가 가지고있는 ninject configuration
[assembly: WebActivator.PreApplicationStartMethod(typeof(PublicPanama.AppStart_NinjectMVC3), "Start")]
namespace Web{
public static class AppStart_NinjectMVC3 {
public static void RegisterServices(IKernel kernel) {
//kernel.Bind<IThingRepository>().To<SqlThingRepository>();
kernel.Bind<IContributorService>().To<ContributorService>();
}
public static void Start() {
// Create Ninject DI Kernel
IKernel kernel = new StandardKernel();
// Register services with our Ninject DI Container
RegisterServices(kernel);
// Tell ASP.NET MVC 3 to use our Ninject DI Container
DependencyResolver.SetResolver(new NinjectServiceLocator(kernel));
}
}
}
,
문제는 ... 나는 또한 데이터 프로젝트에 대한 참조가없는
kernel.Bind<IRepository>().To<Repository>();
하지만 내 웹 프로젝트를 추가 할,하고 그냥이 나던에 대한 참조를 추가 바로 보인다 ..
무엇 내가 빠졌어? 도와주세요!
왜 데이터 프로젝트에 대한 참조를 추가하지 않습니다 (문서에서 ref'd) @ 브래드 윌슨의 블로그 시리즈를 읽을 것을 잊지 말아 바로 보인다? 아마도 당신은 Services 프로젝트에 대한 참조가있을 것입니다. 비슷한 문제가 아닌가? – dommer
당신은 nuget mvc 3 패키지가 튀어 나오거나 ninject.web.mvc 물건을 시도 했습니까? –
@dommer : 요점은, 내 웹 프로젝트는 서비스 프로젝트에서 서비스를 사용합니다. 데이터 프로젝트를 전혀 참조 할 이유가 없습니다 ... 주사해야 할 것을 정의하는 것 외에 ... 내 요점은 .. 지금 나는 ninject를 추가했다. 나는 또한 전혀 필요하지 않은 웹 프로젝트에 많은 참고 문헌을 추가해야한다 ... 아무도이 이상한 것을 발견하지 못한다. – ignaciofuentes