Class ContentType
Basic type information and comparison between types
Inherited Members
Namespace: EPiServer.DataAbstraction
Assembly: EPiServer.dll
Version: 8.11.0Syntax
public class ContentType : IComparable, IComparable<ContentType>, IReadOnly
Constructors
ContentType()
Initializes a new instance of the ContentType class.
Declaration
public ContentType()
ContentType(Int32, Guid, String, String, Boolean, Int32)
Initializes a new instance of the ContentType class.
Declaration
protected ContentType(int id, Guid guid, string name, string description, bool isAvailable, int sortOrder)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | The id. |
System.Guid | guid | The GUID based identifier. |
System.String | name | The name. |
System.String | description | The description. |
System.Boolean | isAvailable | if set to |
System.Int32 | sortOrder | The sort order. |
Properties
ACL
Gets or sets the AccessControlList for this content type.
Declaration
public AccessControlList ACL { get; set; }
Property Value
Type | Description |
---|---|
AccessControlList |
Remarks
The implementation for content types currently only respects the Create permission setting.
DefaultMvcController
Gets or sets the Type of the TemplateModel in SupportedTemplates that should be used as the default template used for web requests.
Declaration
public Type DefaultMvcController { get; set; }
Property Value
Type | Description |
---|---|
System.Type |
Remarks
The value is a MVC controller.
DefaultMvcPartialView
Gets or sets the Name of the MVC partial view TemplateModel in SupportedTemplates that should be used as the default used for web requests.
Declaration
public string DefaultMvcPartialView { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
The value is the name of a MVC partial view.
DefaultWebFormTemplate
Gets or sets the Type of the TemplateModel in SupportedTemplates that should be used as the default template used for web requests.
Declaration
public Type DefaultWebFormTemplate { get; set; }
Property Value
Type | Description |
---|---|
System.Type |
Remarks
The value can either be a webform or a user control.
Description
Gets or sets the description of this content type instance.
Declaration
public string Description { get; set; }
Property Value
Type | Description |
---|---|
System.String |
DescriptionLocalizationFormat
Gets the description localization format.
Declaration
protected virtual string DescriptionLocalizationFormat { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
The format that is used when localizing the Description in LocalizedDescription.
DisplayName
Gets or sets the diplay name of this content type instance.
Declaration
public string DisplayName { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
This is the name for the content type in UI. When accessing the content type programatically Name should be used.
FullName
Gets or sets the full name formed by group name between brackets and Name
Declaration
public string FullName { get; }
Property Value
Type | Description |
---|---|
System.String |
GroupName
Gets or sets the group name of this content type instance.
Declaration
public string GroupName { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
This is added in brackets to the DisplayName in UI.
GroupNameLocalizationFormat
Gets the group name localization format.
Declaration
protected virtual string GroupNameLocalizationFormat { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
The format that is used when localizing the GroupName in LocalizedFullName.
GUID
Gets or sets the globally unique identifier for this content type instance.
Declaration
public Guid GUID { get; set; }
Property Value
Type | Description |
---|---|
System.Guid |
ID
Gets or sets the unique identifier for this content type instance.
Declaration
public int ID { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
IsAvailable
Gets or sets if the ContentType should be available in edit mode.
Declaration
public bool IsAvailable { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsNew
Gets a value indicating whether this content type has been saved to the database.
Declaration
public bool IsNew { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
IsReadOnly
Gets a value indicating if current instance is read-only.
Declaration
public virtual bool IsReadOnly { get; protected set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
LocalizationService
The localization service used to resolve LocalizedName and LocalizedDescription.
Declaration
protected LocalizationService LocalizationService { get; set; }
Property Value
Type | Description |
---|---|
LocalizationService |
LocalizedDescription
Gets the description of this content type localized to current language. If no localized description exist the standard Description will be returned.
Declaration
public string LocalizedDescription { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
To localize the content type description it should be located at the language path
"/contenttypes/contenttype/[YourContentTypeName]/description", where YourContentTypeName matches
the name of the content type.
LocalizedFullName
Gets the localized name of the content type including the group name.
Declaration
public virtual string LocalizedFullName { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
LocalizedGroupName
Gets the localized group name.
Declaration
public virtual string LocalizedGroupName { get; }
Property Value
Type | Description |
---|---|
System.String | The localized group name. |
LocalizedName
Gets the name of this content type localized to the current language. If no localized name exist the standard Name will be returned.
Declaration
public string LocalizedName { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
To localize the content type name it should be located at the language path
"/contenttypes/contenttype/[YourContentTypeName]/name", where YourContentTypeName matches
the Name of the content type.
ModelType
Gets the System.Type of the model used to represent this type.
Declaration
public Type ModelType { get; set; }
Property Value
Type | Description |
---|---|
System.Type |
ModelTypeString
Gets or sets the string format of the model type.
Declaration
public string ModelTypeString { get; set; }
Property Value
Type | Description |
---|---|
System.String | The model type string. |
Name
Gets or sets the name of this content type instance.
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String |
NameLocalizationFormat
Gets the name localization format.
Declaration
protected virtual string NameLocalizationFormat { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
The format that is used when localizing the Name in LocalizedName.
PropertyDefinitions
Gets a PropertyDefinitionCollection containing all property definitions used by this content type.
Declaration
public PropertyDefinitionCollection PropertyDefinitions { get; }
Property Value
Type | Description |
---|---|
PropertyDefinitionCollection |
Remarks
The contents of this collection will not be persisted when the page or block that uses it is saved. If you want to work with property definitions, use the IPropertyDefinitionRepository.
SortOrder
Gets or sets the default sort index based on other types
Declaration
public int SortOrder { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
SupportedTemplates
Gets a list of all the templates that supports the current type.
Declaration
[Obsolete("Get templates by calling ServiceLocator.Current.GetInstance<TemplateModelRepository>().List(contentType.ModelType)")]
public IEnumerable<TemplateModel> SupportedTemplates { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<TemplateModel> |
Methods
CompareTo(Object)
Declaration
public int CompareTo(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Int32 |
CreateWritableClone()
Creates a writable clone of this object.
Declaration
public object CreateWritableClone()
Returns
Type | Description |
---|---|
System.Object | A clone of this object that is writable. |
CreateWritableCloneImplementation()
The method called by IReadOnly.CreateWritableClone.
Declaration
protected virtual object CreateWritableCloneImplementation()
Returns
Type | Description |
---|---|
System.Object | A clone of this object that is writable. |
Remarks
This method is called by CreateWritableClone(). If you are inheriting, directly or indirectly, from ContentType you should override this method to make sure that all reference type members of your class are cloned.
Your override of this method must create the clone by calling base.CreateWritableCloneImplementation()
. This ensures that all
classes in the inheritance chain can create clones as necessary. Also, by calling the base implementation the values of all value
type members are copied as ContentType's implementation of this method calls System.Object.MemberwiseClone().
Equals(Object)
Determines whether this instance of ContentType
and a specified object, which must also be a ContentType
object, have the same value.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | An object. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Overrides
GetHashCode()
Returns the hash code for this ContentType.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | A 32-bit signed integer hash code. |
Overrides
MakeReadOnly()
Makes the current instance and all it's properties read-only.
Declaration
public virtual void MakeReadOnly()
Remarks
After calling this method the IsReadOnly property will return true
.
ResetContentType()
Resets data that can be set from model.
Declaration
public virtual void ResetContentType()
ThrowIfReadOnly()
Throws an exception if the current instance is read-only.
Declaration
protected virtual void ThrowIfReadOnly()
Operators
Equality(ContentType, ContentType)
Determines whether two specified ContentType
objects have the same value.
Declaration
public static bool operator ==(ContentType x, ContentType y)
Parameters
Type | Name | Description |
---|---|---|
ContentType | x | A |
ContentType | y | A |
Returns
Type | Description |
---|---|
System.Boolean |
|
Inequality(ContentType, ContentType)
Determines whether two specified ContentType
objects have different values.
Declaration
public static bool operator !=(ContentType x, ContentType y)
Parameters
Type | Name | Description |
---|---|---|
ContentType | x | A |
ContentType | y | A |
Returns
Type | Description |
---|---|
System.Boolean |
|
Explicit Interface Implementations
IComparable<ContentType>.CompareTo(ContentType)
Declaration
int IComparable<ContentType>.CompareTo(ContentType other)
Parameters
Type | Name | Description |
---|---|---|
ContentType | other |
Returns
Type | Description |
---|---|
System.Int32 |