Data Access has been discontinued. Please refer to this page for more information.

How to: Decorate Entities And Properties With Attributes

This article is relevant to entity models that utilize the deprecated Visual Studio integration of Telerik Data Access. The current documentation of the Data Access framework is available here.

This article demonstrates to you how to decorate the members of your domain model with attributes:

The project that holds the domain model has to have a reference to the assembly, which distributes the attribute.

How to: Decorate Persistent Classes

The persistent classes can be decorated with attributes in two ways:

Through Attributes Editor

To decorate a class with an attribute with the help of Attributes Editor you can apply the following steps:

  1. Open the domain model in Visual Designer.
  2. Click on the persistent class that needs to be decorated in the diagram and in Properties Window, select Attributes Editor.

  3. In the Attribute section start typing the name of the attribute. The text under the section will notify you about possible attributes that match the text you are typing. You can use the Up and Down keyboard arrows to view them.

  4. Provide the arguments of the attribute, if needed, and click on the Add button to add them to the list of the attributes associated with the domain class.
  5. Once you decorate the domain class with all the needed attributes, click OK to close Attributes Editor.

  6. Save the domain model.

With A Model Operation

Decorating domain classes with attributes through a model operation can be achieved with the next steps:

  1. Open the domain model in Visual Designer.
  2. Right-click on the surface of the designer and select Model Operations... to run the Model Operations dialogue.

  3. Through Search and Display View find the domain class that needs to be decorated with an attribute.

  4. Select the class in the grid.
  5. From Model Operations View select the Manage Attributes operation.
  6. From the Settings section, select the Add Attribute option.
  7. Start typing the name of the attribute in the text field. The text under the field will notify you about possible attributes that match the text you are typing. You can use the Up and Down keyboard arrows to view them.
  8. Provide the arguments of the attribute, if needed, and click on the Execute button to add them to the list of the attributes associated with the domain class.
  9. Once you decorate the domain class with all the needed attributes, click Close to close Model Operations.
  10. Save the domain model.

How to: Decorate Persistent Properties

The persistent properties can be decorated with attributes in two ways:

Through Attributes Editor

To decorate a property with an attribute with the help of Attributes Editor you can apply the following steps:

  1. Open the domain model in Visual Designer.
  2. On the diagram, locate the domain class with the property, which needs to be decorated.
  3. Click on the property and in Properties Window, select Attributes Editor.

  4. In the Attribute section start typing the name of the attribute. The text under the section will notify you about possible attributes that match the text you are typing. You can use the Up and Down keyboard arrows to view them.

  5. Provide the arguments of the attribute, if needed, and click on the Add button to add them to the list of the attributes associated with the property.
  6. Once you decorate the property with all the needed attributes, click OK to close Attributes Editor.

  7. Save the domain model.

With A Model Operation

Decorating properties with attributes through a model operation can be achieved with the next steps:

  1. Open the domain model in Visual Designer.
  2. Right-click on the surface of the designer and select Model Operations... to run the Model Operations dialogue.

  3. Through Search and Display View find the property that needs to be decorated with an attribute.

  4. Select the property in the grid.
  5. From Model Operations View select the Manage Attributes operation.
  6. From the Settings section, select the Add Attribute option.
  7. Start typing the name of the attribute in the text field. The text under the field will notify you about possible attributes that match the text you are typing. You can use the Up and Down keyboard arrows to view them.
  8. Provide the arguments of the attribute, if needed, and click on the Execute button to add them to the list of the attributes associated with the property.
  9. Once you decorate the domain class with all the needed attributes, click Close to close Model Operations.
  10. Save the domain model.