Here is a possible workaround...Use a KernelPersister to state the kernel, and reference it directly from within your base View. It's not as pretty and seamless as constructor injection, but it does the trick.
KernelPersister might look like this...
public static class KernelPersister
{
static IKernel persistedKernel;
/// <summary>
/// Persists the provided kernel
/// </summary>
public static void Set(IKernel kernel)
{
if(persistedKernel == null)
{
throw new ArgumentNullException("kernel");
}
persistedKernel = kernel;
}
/// <summary>
/// Gets the persisted kernel
/// </summary>
public static IKernel Get()
{
if(persistedKernel == null)
{
throw new Exception("The kernel must be actively set in the persister");
}
return persistedKernel;
}
}
Base view might look like this...
public abstract class MyBaseView : System.Web.Mvc.WebViewPage
{
/// <summary>
/// Gets access to the MyService
/// </summary>
protected IMyService MyService {get; private set;}
/// <summary>
/// ctor the Mighty
/// </summary>
public MyBaseView()
{
var kernel = KernelPersister.Get();
this.MyService = kernel.GetService(typeof(IMyService)) as IMyService;
}
}