I have the following httphandler:
public class NewHandler : IHttpHandler
{
[Inject]
public IFile FileReader
{
get;
set;
}
public NewHandler()
{
}
public void ProcessRequest(System.Web.HttpContext context)
{
....
var something = SomeMethod(FileReader);
....
}
public bool IsReusable
{
get
{
return true;
}
}
}
This is my Ninject Module in the Global.asax.
internal class ServiceModule : NinjectModule
{
public override void Load()
{
Bind<IFile>().To<FileWrapper>().InSingletonScope();
}
}
Every time the handler fires the FileReader is NULL. Am I missing something? Is this the correct way to do property injection using Ninject?
Thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…