Class TemplateModelComparerFactory
Factory class responsible for creating a System.Collections.Generic.IComparer<T> for a specific model type.
Inheritance
Implements
Inherited Members
Namespace: EPiServer.DataAbstraction.RuntimeModel
Assembly: EPiServer.dll
Version: 9.12.2Syntax
[ServiceConfiguration(typeof(ITemplateModelComparerFactory))]
public class TemplateModelComparerFactory : 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<T> 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> |