Ninject working with WCF Web API Preview 5

后端 未结 3 1793
我寻月下人不归
我寻月下人不归 2021-01-04 23:18

Can anybody point me in the right direction to get Ninject working with WCF Web API Preview 5? I have it successfully up and running in my ASP.NET MVC 3 project and also in

3条回答
  •  旧时难觅i
    2021-01-04 23:55

    In P5 you have to derive from WebApiConfiguration and use your derived configuration:

    public class NinjectConfiguration : WebApiConfiguration
        {
            public NinjectConfiguration(IKernel kernel)
            {
                CreateInstance((t, i, m) =>
                {
                    return kernel.Get(t);
                }); 
            }
        }
    

提交回复
热议问题