With the following BaseViewPage class:
public abstract class BaseViewPage : WebViewPage {
[Dependency]
public IAuthorizationService Authorization { get; set; }
}
In a standard razor view (with @inherits BaseViewPage at the top) the IAuthorizationService is resolved correctly. But in a Layout page (which also inherits from BaseViewPage) the Authorization property is null.
Looking at the comments in the following article it suggests that this is an issue with ASP.NET and is not specific to MVC.
http://bradwilson.typepad.com/blog/2010/10/service-location-pt11-view-page-activator.html
public abstract class BaseViewPage : WebViewPage {
[Dependency]
public IAuthorizationService Authorization { get; set; }
}
In a standard razor view (with @inherits BaseViewPage at the top) the IAuthorizationService is resolved correctly. But in a Layout page (which also inherits from BaseViewPage) the Authorization property is null.
Looking at the comments in the following article it suggests that this is an issue with ASP.NET and is not specific to MVC.
http://bradwilson.typepad.com/blog/2010/10/service-location-pt11-view-page-activator.html