C# Class Sdl.Web.Common.Models.EntityModel

Abstract base class for View Models for Entities.
Inheritance: ViewModel, IRichTextFragment, IEntity
Exibir arquivo Open project: sdl/dxa-web-application-dotnet Class Usage Examples

Private Properties

Property Type Description

Public Methods

Method Description
DeepCopy ( ) : ViewModel

Creates a deep copy of this View Model.

Equals ( object obj ) : bool

Determines whether the specified object is equal to the current Entity Model.

GetDefaultView ( Sdl.Web.Common.Configuration.Localization localization ) : MvcData

Gets the default View for this Entity Model (if any).

If this method is overridden in a subclass, it will be possible to render "embedded" Entity Models of that type using the Html.DxaEntity method.

GetHashCode ( ) : int

Serves as a hash function for a particular type.

GetXpmMarkup ( Sdl.Web.Common.Configuration.Localization localization ) : string

Gets the rendered XPM markup

ToHtml ( ) : string

Gets an HTML representation of the Entity Model.

This method is used when the EntityModel is part of a RichText instance which is mapped to a string property. In this case HTML rendering happens during model mapping (by means of this method), which is not ideal. Preferably, the model property should be of type RichText and the View should use @Html.DxaRichText() to get the rich text rendered as HTML.

ToString ( ) : string

Returns a string that represents the current object.

Method Details

DeepCopy() public method

Creates a deep copy of this View Model.
public DeepCopy ( ) : ViewModel
return ViewModel

Equals() public method

Determines whether the specified object is equal to the current Entity Model.
public Equals ( object obj ) : bool
obj object The object to compare with the current object.
return bool

GetDefaultView() public method

Gets the default View for this Entity Model (if any).
If this method is overridden in a subclass, it will be possible to render "embedded" Entity Models of that type using the Html.DxaEntity method.
public GetDefaultView ( Sdl.Web.Common.Configuration.Localization localization ) : MvcData
localization Sdl.Web.Common.Configuration.Localization The context Localization.
return MvcData

GetHashCode() public method

Serves as a hash function for a particular type.
public GetHashCode ( ) : int
return int

GetXpmMarkup() public method

Gets the rendered XPM markup
public GetXpmMarkup ( Sdl.Web.Common.Configuration.Localization localization ) : string
localization Sdl.Web.Common.Configuration.Localization The context Localization.
return string

ToHtml() public method

Gets an HTML representation of the Entity Model.
This method is used when the EntityModel is part of a RichText instance which is mapped to a string property. In this case HTML rendering happens during model mapping (by means of this method), which is not ideal. Preferably, the model property should be of type RichText and the View should use @Html.DxaRichText() to get the rich text rendered as HTML.
/// This method must be overridden in a concrete subclass which is to be embedded in rich text. /// For example, see . ///
public ToHtml ( ) : string
return string

ToString() public method

Returns a string that represents the current object.
public ToString ( ) : string
return string