I am new to Ninject and I need help to move on.
I have a solution that consists of web.form projects (presentation) and various class library projects.
In the web.form application, inside the cs file of ninjectWebCommon, I have the following
kernel.Bind<HttpContext>()
.ToMethod(ctx => HttpContext.Current).InThreadScope();
kernel.Bind<HttpContextBase>()
.ToMethod(ctx => new HttpContextWrapper(HttpContext.Current)).InTransientScope();
kernel.Bind<MPIBE.DESTINATION.CORE.SiteContext>()
.ToMethod(ctx => new MPIBE.DESTINATION.CORE.SiteContext(new HttpContextWrapper(HttpContext.Current)));
I am trying to get an instance of a class (after the constructor)
public SessionUtilities(SiteContext siteContext)
{
_siteContext = siteContext;
}
and I noticed that I can only get an instance of the web.forms application form, and I cannot get from other projects (class libraries). It makes sense?
I am trying to get an instance using property insert
[Inject]
public SessionUtilities _sessionUtilities { get; set; }
I will be grateful for any comments.
thanks
source
share