page header

Attribute Definition / Additional Interfaces Macro Definitions

The LLBLGen Pro designer allows you to specify additional interfaces and attribute definitions for elements, which are used to produce .NET attribute definitions in the generated sourcecode. To add additional interfaces and/or attribute definitions to an element, you either use the Project Settings Editor or edit the additional interfaces and attributes on the code generation info tab of the element: (Entity, Typed List, Typed View or Value Type). To make the definition as generic as possible (so the additional interfaces and attribute definition can be defined at the project level in the Project Properties Editor), macros can be used.

Macros usable only for Attribute Definitions

The following macros are supported only for attribute definitions.

Macros usable for Attribute Definitions and Additional Interfaces

The following macros are supported for both Attribute Definitions and Additional Interfaces. These have a slightly different syntax as the macros above and are given below.

Attributes and constants

.NET Attribute definitions are defined using constants, it therefore might be necessary to specify a specific type for a constant. E.g. 10 is seen as an integer, but it might be necessary to define that as a byte or short/Int16. To do this, one should use the 5 specific cast keywords if the value specified is ambiguistic and by default is seen as a value of a different type: numbers without fraction are by default seen as integers by compilers and numbers with fraction are by default seen as doubles. To specify a cast, use the syntax: $typename(value). For example: $byte(10). This will resolve to either (byte)(10) for C#, or to CByte(10) for VB.NET. Not specifying the value in parenthesis could cause problems for vb.net and there's no checking done on this.

It's not necessary to wrap the attribute in [] characters for C# or <> characters for VB.NET nor is it necessary to append a '_' for VB.NET, this is done by the code generator automatically.


LLBLGen Pro Designer v4.2 documentation. ©2002-2015 Solutions Design