Attributes

Attributes control how content types and their fields are displayed end edited. See below for a list of common attributes and their usage.

[Serializable]

Marks the content type as serializable. Classes without this attribute will not be recognized by Lemoon as a content type. i.e. this attribute is mandatory for content type classes.

[Icon("name")]

Use [Icon("name")] to specify the icon to use for an extension. Choose from some of the common icons (blog, content, form, site, etc) or define your own using css.

[DefaultValues(...)]

Use the DefaultValuesAttribute to configure the initial settings for a content type. These settings can later be changed in the admin UI. The DefaultValuesAttribute has the following properties:

NameDescriptionData type
IsSearchable Sets a value indicating whether the content type should be searchable. bool
DisplayInMenu Sets a value indicating whether the content type should be displayed in menus. Mindroute.Core.Model.DisplayInMenu
IsEnabled Sets a value indicating whether the content type is enabled. bool
Template

Sets the template to use when rendering the content type.

string
AllowedChildren Sets the list of allowed child content types for this content type. string[]

[Render(...)]

Provides a general-purpose attribute to specify how content types and their fields are displayed in the UI. The RenderAttribute has the following properties:

NameDescriptionData type
Name Gets or sets a value that is used for display in the UI. The name is typically used as the field label for form controls. string
Description Gets or sets a value that is used to display a description in the UI. string
ResourceType Gets or sets the type that contains the resources for the Name and Description properties. Default: null (the provided literal values). type
ExportTitle Gets or sets a value that is used as an alternate title when exporting a form result. string
Weight Gets or sets a value that decides the order in which the property will appear in lists. A lower weight value will float to the top of lists, while heavier weights will appear lower in lists. short
ShowForDisplay Gets or sets a value indicating whether the property should be shown in display mode. Default: true. bool
ShowForEdit Gets or sets a value indicating whether the property should be shown in edit mode. Default: true. bool

[Persisted(...)]

Specifies that a property should be persisted to the repository. Properties that are not decorated with the persisted attribute will not be recognised as a content type field. The PersistedAttribute has the following properties:

NameDescriptionData type
IsReadOnly Gets or sets a value indicating whether the field is read-only, i.e. if it is editable or not. Default is false. bool

 

 

 

 

DataTypeAttribute (properties)

[DataType("string value")]

The data type is used in conjunction with other attributes to conclude which control that should render a property and / or which validation to apply to the property. Please see the examples page.

 

RequiredAttribute (properties)

[Required]

Specifies that the property is required.

 

DefaultValueAttribute (properties)

[DefaultValue(value)]

A default value for the property. See msdn.

UIHint (properties)

[UIHint(...)]

Primarily used to pass templating information to the control that renders the property in the admin UI.