ASP.NET Web Forms + Ninject + Helper Class with iService - how to make Ninject handle iService?
<p>I have an ASP.NET Web Forms project written in VB.NET running on .NET 4.5.2</p>

<p>I've successfully plugged Ninject into my application however I've hit a snag.</p>

<p>I'm using Ninject Property Injection within my web pages (sample below)</p>

<pre><code>Partial Class MyPage
    Inherits Page

&lt;Inject&gt;
Public Property _myService As IService
</code></pre>

<p>All calls to this work...so this is fine</p>

<pre><code>_myService.DoWork()
</code></pre>

<p>However, within my application we have a class that we use to wrap calls into our service (see below)</p>

<pre><code>Public Class MyWrapper

    &lt;Inject&gt;
    Public Property _myService As IService

    Public Sub DoWork()
        _myService.DoWork()
    End Sub

End Class
</code></pre>

<p>This class is used by web pages...</p>

<pre><code>Dim wrapper As New MyWrapper()

wrapper.DoWork()
</code></pre>

<p>This doesn't work - within the MyWrapper class, Ninject isn't injecting the IService.</p>

<p>I'm guessing that because my class isn't a web page, it's not in the pipeline and so Ninject isn't doing anything with it.</p>

<p>I've read some other posts that suggest amending MyWrapper to inherit from Ninject.Web.PageBase but having tried this it doesn't seem to work.</p>

<p>Has anyone got any suggestions?</p>

<p>MyWrapper has 100+ references within our application so ideally I don't want to have to change every line of code.</p>

<p>Also, the MyWrapper class has some Shared/Static methods - will this cause a problem (I can change this if necessary).</p>

<p>FYI - the above code should be treated a pseudo code - I typed it adhoc rather than copy-pasting - and so it may contain syntax errors.</p>