1

나는 asp.net에서 응용 프로그램을 개발하고있는 I는 내가 바인딩 오전 Ninject에 인터셉터를 구현하고/I가를 부르고 때Ninject에 인터셉터 beforeinvoke 두 번 호출하고 afterinvoke 방법

kernel.Bind<IPracticeManagement>().To<PracticeManagementClient>().InRequestScope().Intercept().With<TimingInterceptor>(); 

같은 서비스를 등록 이 서비스의 메소드

public class HomeController : Controller 
    { 
     private readonly IPracticeManagement _practiceManagement; 

     public HomeController(IPracticeManagement practiceManagement) 
     { 
      this._practiceManagement = practiceManagement; 
     } 

     public ActionResult Index() 
     { 

      var specialities = this._practiceManagement.GetSpecialty(); 

      this.ViewBag.Specialities = specialities; 

      ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application."; 

      return View(); 
     } 
} 

메소드 BeforeInvoke가 TimeInterceptor에서 두 번 호출 중입니다. 왜?

+0

'GetSpecialty'에 중단 점을 넣었습니까? 한두 번 호출 되었습니까? 또한'TimingInterceptor' 구현은 어떻게 생겼습니까? – nemesv

+0

GetSpecialty가 한 번 호출합니다. – Billz

+0

그러면 BeforeIncoke에 중단 점을 넣고'GetSpecialty'를 요청하고 두 번째로 다른 메소드를 요청하는'invocation'을 체크해야합니다 ... – nemesv

답변

0

Ninject.Extensions.Interception.DynamicProxyNinject.Extensions.Interception.Linfu이 모두 설치되어있을 수 있습니다. 그렇다면 그 중 하나만 사용하십시오.