The LLBLGen Pro designer generates source-code and the generated classes and their properties might need additional .NET attributes defined for a given purpose, e.g. validation attributes or data contract attributes or other attributes defined by the .NET framework or your own code. Modifying generated property definitions in generated classes is risky as they get overwritten the next time the code is overwritten.
For this reason the LLBLGen Pro designer offers a way to define the .NET attribute definitions at the model level, so they can be generated into the generated code on properties and classes representing the elements the attributes are defined on. There are two levels you can define the attribute definitions: at the project level and at the element level. Every attribute defined on the project level for a given element type (e.g. 'Entity'), is inherited by an instance of that type: e.g. the entity definition 'Customer' as an entity inherits the attributes defined for 'Entity' at the project level'.
At the element level, you can decide whether the particular element indeed inherits the attribute definition (leave it as-is) or not (uncheck the Inherit checkbox). If just a few elements shouldn't get a particular attribute defined at the project level, this isn't a big problem. However if an attribute should only be assigned to an element with specific aspects (e.g. a StringValidationAttribute should only be assigned to Fields which are of type 'string'), it gets cumbersome to uncheck all these checkboxes.
LLBLGen Pro therefore allows you to define rules for each attribute defined on the project level. A rule is an expression which has to resolve to true for the element at hand if the attribute is to be defined on said element. If the rule resolves to true (or there's no rule) the element will inherit the attribute. By default no rule is present for an attribute definition, which means it's defined on all elements of the given type. This means that for the StringValidationAttribute attribute definition on the element type Field, we can define a rule which states that the FieldType should be String. The rule only resolves to true for fields of type String so only those fields will inherit this attribute at the element level.
To edit a rule for an attribute, select the attribute in the Project Settings and click the button in the Has Rule column. This opens the rule editor which is a dynamic dialog. At first, there's only a [+] button, which allows you to add the first expression. Clicking a [+] adds a new expression part to the full expression, and which are combined using logical operators selectable in the dialog.
Clicking OK saves the rule for the attribute in the project settings. When OK is clicked to close the Project Settings Editor, the attributes are assigned immediately. This is dynamic, so changing an aspect of an element, e.g. the type of a field, will immediately have the effect that the attributes are updated.
To be able to define attributes which reflect values of the element they're defined on (e.g. the max length of a field in a validation attribute defined on the property representing the field), LLBLGen Pro uses a macro language. It's described in more detail in its own section.