Coalesce provides a number of C# attributes that can be used to decorate your model classes and their properties in order to customize behavior, appearance, security, and more. Coalesce also supports a number of annotations from
Visit each link below to learn about the attribute that Coalesce provides that can be used to decorate your models.
Coalesce also supports a number of the built-in
System.ComponentModel.DataAnnotations attributes and will use these to shape the generated code.
The displayed name and description of a property, as well as the order in which it appears in generated views, can be set via the
[Display] attribute. By default, properties will be displayed in the order in which they are defined in their class.
The displayed name of a property can also be set via the
[Required] will generate client validation rules. See [ClientValidation].
[MinLength] will generate client validation rules. See [ClientValidation].
[MaxLength] will generate client validation rules. See [ClientValidation].
Normally, Coalesce figures out which properties are foreign keys, but if you don't use standard EF naming conventions then you'll need to annotate with
[ForeignKey] to help out both EF and Coalesce. See the Entity Framework Relationships documentation for more.
Sometimes, Coalesce (and EF, too) can have trouble figuring out what the foreign key is supposed to be for a collection navigation property. See the Entity Framework Relationships documentation for details on how and why to use
Primary Keys with
[DatabaseGenerated(DatabaseGeneratedOption.None)] will be settable on the client and will be appropriately handled by the Standard Behaviors on the server. Currently unsupported on the Knockout front-end stack.