Database Modeling with Microsoft Visio for Enterprise Architects

ORM constraints apply either to an object type or to one or more roles. This section discusses how to add constraints to an object type. The rest of the chapter explains how to add all the role-based constraints.
The previous chapter showed how to constrain the possible values for an object type by associating it with a data type. You can further constrain an object type by confining its possible values to a list or range of values within its data type. For example: SexCode = { M , F }; Score = {1..100}; SQLchar = { a .. z , A .. Z , O .. 9 , _ }. These are called value constraints because they limit the allowed values for a value type. If you apply a value constraint to an entity type, e.g. Sex(Code), the constraint is understood to apply to the associated value type, e.g. SexCode.
To add a value constraint to an object type, first ensure it is displayed it in the drawing window. Select or double-click the object type to bring up its Database Properties window. Open the Value pane by selecting Value from the list of categories. To add a value to the constraint, type the value in the Value field and press the Add button. The tool immediately displays the current list of values in braces next to the object type. If the data type is character-based, the tool adds single quotes around each value. Do not add quotes yourself. Figure 5-1 shows how it looks for...