Interface IContentModel
The basic view model returned for front-end Umbraco controllers
Namespace: Umbraco.Cms.Core.Models
Assembly: Umbraco.Core.dll
Syntax
public interface IContentModel
Remarks
IContentModel exists in order to unify all view models in Umbraco, whether it's a normal template view or a partial view macro, or a user's custom model that they have created when doing route hijacking or custom routes.
By default all front-end template views inherit from UmbracoViewPage which has a model of IPublishedContent but the model returned from the controllers is IContentModel which in normal circumstances would not work. This works with UmbracoViewPage because it performs model binding between IContentModel and IPublishedContent. This offers a lot of flexibility when rendering views. In some cases if you are route hijacking and returning a custom implementation of IContentModel and your view is strongly typed to this model, you can still render partial views created in the back office that have the default model of IPublishedContent without having to worry about explicitly passing that model to the view.
Properties
View SourceContent
Gets the IPublishedContent
Declaration
IPublishedContent Content { get; }
Property Value
Type | Description |
---|---|
IPublishedContent |