Data Annotations Metadata Template

This template is designed for generating Data Annotations metadata classes and decorating entity classes and properties with data annotation attributes that specify validation rules, specify how the data is displayed, and define metadata for Windows Communication Foundation (WCF), Dynamic Data and WCF RIA Services. For each model entity the template generates a partial class with an attribute, specifying a metadata class, and the metadata class itself.

 

ExpandedToggleIcon        Template Properties

General

Description

Description of the template.

Enabled

Indicates whether the template is enabled. Acceptable values are True or False.

File Name

The name of the template file.

Name

The name of the template.

Type

The type of the template.

Generation

Generate Display Resource File

Determines whether a resource file, containing the DisplayName strings for entity properties, will be generated and used by the Display attribute, or the DisplayName values will be hardcoded into the generated Display attributes. Default value is False, which means, hard-coded values will be used.

If this property is set to True, ResourceType for a Display attribute will be typeof(<#= resourceTypeName #>), and Name will be specified as a reference to a resource file string. The generated resource file will contain the display name values for all entity properties. If a property does not have display name specified, the corresponding resource file string value will be generated from the property name: a space will be added before each capital letter of the property name.

Nested Metadata

Specifies whether the generated metadata classes should be nested into partial entity classes. Default value is True.

Output

Entities Output

Allows specifying the output folder for the generated entity classes.

Project

(This property is available in the Visual Studio add-in only) The name of the Visual Studio project where the generation result will be located.

Project Folder

(This property is available in the Visual Studio add-in only) The name of the directory in the Visual Studio project where the generation result will be located.

Destination Folder

(This property is available in the standalone application only) The directory to contain the generation results.

Technologies

ASP.NET Core MVC

Specifies whether to generate attributes that define metadata for ASP.NET Core MVC. Default value is False.

Dynamic Data

Specifies whether to generate attributes that define metadata for ASP.NET Dynamic Data. Default value is False.

RIA Service

Specifies whether to generate attributes that define metadata for WCF RIA Services. Default value is False.

WCF Service

Specifies whether to generate attributes that define metadata for Windows Communication Foundation (WCF). Default value is False.

Validation

Validation Error Messages

Specifies error messages to associate with a validation control if validation fails. If you do not want to use hardcoded error messages (e.g. for the sake of internationalization), you can use error messages stored in the application resources. For this, specify the name of the resource type for error messages in the following format: ResourceType=<type name>. Additionally, the resource name for your error message for the corresponding validator must be equal to the name of a property from the ValidationErrorMessages property.

Email Message

Specifies the error message to associate with a validation control if email validation fails.

Expression Message

Specifies the error message to associate with a validation control if regular expression validation fails.

IPAddress Message

Specifies the error message to associate with a validation control if IPAddress validation fails.

Length Message

Specifies the error message to associate with a validation control if length validation fails.

Numeric Message

Specifies the error message to associate with a validation control if numeric validation fails.

Range Message

Specifies the error message to associate with a validation control if range validation fails.

Required Message

Specifies the error message to associate with a validation control if required validation fails.

Validation

Defines whether to generate Data Annotations validation attributes that specify validation rules for entity properties.

 

ExpandedToggleIcon        Extended Properties

For Model Classes

MetaTypeName

The auxiliary metadata type name.

Scaffold

Specifies whether this type should be scaffolded. If this property is True, the ScaffoldTable attribute is added to the class.

DisplayColumn

Specifies the column used to display the entity in other entities' navigation properties. Applied only if the DynamicData template property is set to True. If this property is True, the DisplayColumn attribute is added to the class.

TableName

Specifies the name of the collection of this entity type that is shown to user. Applied only if the DynamicData template property is set to True. If this property is True, the TableName attribute is added to the class.

For Model Properties

DisplayFormat

Specifies how to display values for the property. If this property is True, the DisplayFormat attribute is added to the property.

Scaffold

Specifies whether this property should be scaffolded. If this property is True, the ScaffoldColumn attribute is added to the property.

UIHint

Designates the control to use to display the associated entity property. If this property is True, the UIHint attribute is added to the property.

FilterUIHint

Designates the name of the control to use for filtering. Applied only if the DynamicData template property is set to True. If this property is True, the FilterUIHin attribute is added to the property.

 


Send feedback on this topic

© 2008 - 2024 Devart. All rights reserved.