Billz
Billz

Reputation: 1097

Ninject Interceptor calling twice beforeinvoke and afterinvoke methods

I am developing an app in asp.net in which I am implementing the Ninject Interceptor in which I am binding/registering the service like

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

When I am calling the method of this service

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();
        }
}

The method BeforeInvoke is calling twice in TimeInterceptor. Why?

Upvotes: 1

Views: 382

Answers (1)

Adiono
Adiono

Reputation: 1044

Maybe you have both of Ninject.Extensions.Interception.DynamicProxy and Ninject.Extensions.Interception.Linfu installed? If it so, then try to use only one of it.

Upvotes: 0

Related Questions