开发者

How to get Ninject working with ASP.NET WebForms App

开发者 https://www.devze.com 2023-03-25 06:28 出处:网络
I have a really beginner\'s level question. I am trying to get going with Ninject in an ASP.NET WebForms application, but I don\'t know how. I know how to do this, roughly, in MVC 3, as described he

I have a really beginner's level question.

I am trying to get going with Ninject in an ASP.NET WebForms application, but I don't know how. I know how to do this, roughly, in MVC 3, as described here. But, I'm stuck when trying to do the same thing in a WebForms app.

For example, in a WebForms app, where do I setup binding similar to below?

private static void RegisterServices(IKernel kernel)  
{  
  kernel.Bind<IRepository>().To<MyRepositoryImpl>();
  kernel.Bind<IWebData>().To<MyWebDAtaImpl>();
}

This is an example of the kinds of questions I have, and am hoping the SO community can help with. I have lots of such questions, but in an attempt to just start somewhere, I'll开发者_JAVA技巧 leave off with that one question for now.


Do you mean WebForms?

You will want to do container registration in the global.asax, in the Application_OnStart event.

0

精彩评论

暂无评论...
验证码 换一张
取 消