Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

ContentTypeModel vs ContentType

Vote:
 

Hello all,

I am having trouble with the difference between a ContentType and a ContentTypeModel. They share alot of the same properties, with ContentType having methods that ContentTypeModel. Can anywone help me hash out the difference between these two on a conceptual level?

#123722
Jul 17, 2015 3:17
Vote:
 

The Content Type is the code representation of the fields and other information that will be used in the CMS for your Content (for example Page, Block or Media).

Content Types, their properties and settings are primarily stored in the database and can be managed in the Admin mode but you as a developer can define properties and other settings by code.

In code you can basically set the same settings the administrator can set in Admin mode but it also provides your project some useful tools such as:

* Versioning of changes

* Easier deployments where you don't need to do manual adjustments

* Strongly typed properties where you don't need to Cast your property values

On startup, EPiServer scans your binaries and syncs the database with relevant changes.

Remember that unless you specify in code that the administrator can't do changes, the administrator can do some adjustments to your Content Types such as adding new properties.

The ContentTypeModel is what EPiServer use to work through the information when synchronizing Content Types from code to the database.

In most projects you are not using the ContentTypeModel.

#123733
Jul 17, 2015 14:58
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.