Content fields are pieces of information that can be added to a content type. Content fields have a name and a type and are specific to a content type. There can be several of each field type on any given content type.
In the example above, we have added 4 fields that make sense for meeting minutes; a text field representing the meeting location, a date field representing the date and time of the meeting, a text field for writing down the names of the people attending the meeting, and finally a text field for the meeting notes.
For a property on a content type to be considered a content field, it must be declared as public read-write, i.e. the property has the public
access modifier and have both a get
and a set
accessor.
Content fields must also have one of the following supported types:
enum
byte
short
int
long
bool
double
float
string
Guid
DateTime
TimeSpan
Nullables and Lists of the above types are also supported, e.g. int?
, List<string>
and List<DateTime?>
.
Field attributes
By decorating your fields with one, or more, of the following attributes you can customize how the field is displayed, edited and/or validated.
Datatype
By default, Weavy will look at the property type (in this case string
) when deciding which editor to use for the field. By decorating a field with the [DataType]
attribute you can specify an additional type to associate with the field. This value will then be used by the UI to determine which editor to use for the field.