You can save and load `
IContent` instances through `
IContentRepository`. The most typical content instance is a type inheriting `
PageData`. You can load and save content types other than pages but those content instances do not appear in the editorial interface's page tree.
IContent` stored in the Optimizely Content Management System (CMS) content database must have a corresponding `
ContentType` registered. Classes annotated with the `
ContentType` attribute are automatically scanned for and registered during initialization.
The following example uses the `
Comment` class to define and persist a `
Comment` type. To implement comment functionality, each comment can be saved as an `
IContent` under the page that is commented. However, the comments do not appear in the page tree.
## Define a comment content type
## Save and load comment
The following example creates a `
Comment` instance, saves it, and re-loads it. Use `
IContentRepository` to create, load, and save content instances.