Class TemplateModelComparerFactory
Factory class responsible for creating a System.Collections.Generic.IComparer<> for a specific model type.
Inheritance
Implements
Namespace: EPiServer.DataAbstraction.RuntimeModel.Internal
Assembly: EPiServer.Cms.AspNetCore.Templating.dll
Version: 12.0.3Syntax
public class TemplateModelComparerFactory : Object, ITemplateModelComparerFactory
Remarks
The default implementation will create a comparer that looks at the inheritance chain for where the IRenderTemplate<TModel> for the model type is implemented. And then compare the generic types in the inheritance chain and sort so the model with "shortest" inheritance is inserted before in list. If no IRenderTemplate<TModel> is found (e.g. when explicitly registered partial MVC view) it will be considered prioritized, e.g. inserted before the other item in the list.
Constructors
TemplateModelComparerFactory()
Initializes a new instance of the TemplateModelComparerFactory class.
Declaration
protected TemplateModelComparerFactory()
Remarks
Provided for use when testing or overriding the default implementation.
TemplateModelComparerFactory(TypeRelater)
Initializes a new instance of the TemplateModelComparerFactory class.
Declaration
public TemplateModelComparerFactory(TypeRelater typeRelater)
Parameters
Type | Name | Description |
---|---|---|
TypeRelater | typeRelater | The type relater. |
Methods
Create(Type)
Creates a new System.Collections.Generic.IComparer<> for the specified model type.
Declaration
public virtual IComparer<TemplateModel> Create(Type modelType)
Parameters
Type | Name | Description |
---|---|---|
System.Type | modelType | Type of the model that the comparison should be made on. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IComparer<TemplateModel> |