Ninject is very cool and lightweight DI container.
But you can not always inject objects through constructor – sometimes you must have parameter-less constructor, like in MvcApplication object.
In that case you can use DependencyResolver from System.Web.Mvc namespace from System.Web assembly

_userDataService = 

Unfortunately MSDN documentation does not have much, only link to this blog post:

In Razor compiler directives do not work, cause Razor Views are not compiled.
So this would not work:

@{ #if DEBUG}



But you can trick that thing into submission, thanks to this StackOverflow topic

A better, more generic solution is to use an extension method, so all views have access to it:

public static bool IsReleaseBuild()
    return false;
    return true;

You can then use it like follows in any view (razor syntax):