Attribute mapping for C# (C# code)
ACS generates Class scoped Attributes as class members of the class, struct or interface that is generated for the owning Class.
The following class and struct members can be generated:
Constants – apply the «C# Constant» stereotype to the Attribute.
Events – apply the «C# Event» stereotype to the Attribute.
Fields – apply the «C# Field» stereotype to the Attribute.
Fixed size buffers - apply the «C# Fixed Size Buffer» stereotype to the Attribute.
Properties – apply the «C# Property» stereotype to the Attribute.
The following interface members can be generated:
Events – apply the «C# Event» stereotype to the Attribute.
Properties – apply the «C# Property» stereotype to the Attribute.
If none of the preceding Stereotypes are applied to the Attribute, ACS generates the Attribute as a field.
ACS generates the child items, properties and tagged values of an Attribute as follows.
Child items:
An Attribute does not have any child items that are generated.
Properties:
The Behavior property is ignored.
The Composite property is ignored.
If the Data Type property is set, ACS generates the value as the class or struct member's type, unless a delegate is specified through the C# Delegate Type tag definition.
* 
Note that if the type is a class, interface or struct, you may prefer to model a constant, field or property (not events) through a Role, rather than an Attribute. For more information about Role mapping, click here Association mapping
If the Default Value property is set, ACS generates the value as the default value of the class or struct member when appropriate.
If the Description property has a value, ACS generates the description on the line before the member declaration. For information about how comments are generated, click here Generating code comments
ACS generates the Multiplicity property as follows (not used events and must be set to User Defined for fixed size buffers):
if zero or one – ACS generates the Data Type with a '?' type modifier (as a nullable type).
if only one – ACS generates the Data Type as is.
if zero or more – ACS generates a 'using System.Collections;' statement, and 'ArrayList' for the type.
if one or more – ACS generates a 'using System.Collections;' statement, and 'ArrayList' for the type.
if tbd – ACS ignores the Attribute.
if user defined – the value determines how ACS generates the code: If the user defined value matches one of the preceding values (such as zero or one), ACS generates it accordingly. If the value is an integer value that is greater than 1, ACS generates the Data Type followed by '[]'. If the value is none of the preceding, ACS generates the Data Type as is, followed by the user defined value.
ACS generates the Name property as the identifier of the class or struct member in the code.
* 
Note that ACS may modify the Attribute name that is added to the code to make it valid for C#. You can specify the exact Attribute name to add to the code through the CODE_GENERATION_NAME property of an Attribute. Tell me more...
The Port property is ignored
If the Read Only property is set to true (Read Only check box selected on Property Pages), ACS generates the class or struct member with the readonly modifier when the Attribute maps to a C# field.
If the Storage property is set to On Class, ACS generates the member with the static modifier.
The Unique property is ignored.
The Visibility property can be set to Public, Private, Protected or Package:
If the Visibility is set to Public, Protected or Private, ACS generates the class or struct member with either a public, protected or private modifier.
If the Visibility is set to Package, the class or struct member is treated as an internal.
If the tagged value of the C# Internal tag definition is set to internal or protected internal, the Visibility property is ignored.
Tag Definitions:
For Constants
If the «C# Constant» stereotype is applied to the Attribute, ACS generates the Attribute as a constant. When you set up an Attribute as a constant, set the Read Only property to True (Read Only check box on the Property Pages), else a warning message will be generated. The «C# Constant» stereotype applies the following tag definitions to an Attribute:
If the type of the constant is a generic type, ACS generates the tagged value of the C# Actual Parameters tag definition as the type arguments for that generic type.
If a value is set for the tagged value of the C# Attributes tag definition, ACS generates the value as the attributes of the constant.
If the tagged value of the C# Delegate Type tag definition references an Operation, ACS generates the value as type of the constant.
If the tagged value of the C# Internal tag definition is set to Internal, ACS generates the constant with the internal modifier. If a value of the C# Internal tag definition is set to Protected Internal, ACS generates the constant with the protected internal modifiers.
If the tagged value of the C# Needs Qualified Type tag definition is set to True, ACS generates the constant's type using its fully qualified name, rather than its unqualified name.
If the tagged value of the C# New tag definition is set to True, ACS generates the new keyword when appropriate.
For Events
If the «C# Event» stereotype is applied to the Attribute, ACS generates the Attribute as an event. When you set up an Attribute as an event, you must associate the Attribute with the event's Operation through the C# Event Type tag definition.
* 
ACS generates an event only after tagged values are set for both the C# Add Accessor Body and C# Remove Accessor Body tag definitions.
The «C# Event» stereotype applies the following tag definitions to an Attribute:
If the tagged value of the C# Abstract tag definition is set to True (and the Attribute is not virtual, sealed or extern, and has on class Storage), ACS generates the event with the abstract modifier, assuming that the owning Class, Data Type or Signal is abstract.
If a value is set for the tagged value of the C# Add Accessor Attributes tag definition, ACS generates the value on the line before the Add statement as the attributes of the add accessor declaration.
If a value is set for the tagged value of the C# Add Accessor Body tag definition, ACS generates the value as the body code of the add accessor declaration.
If reverse engineering is enabled in ACS, you can change the body code of the add accessor in the code file and ACS will update the tagged value of the C# Add Accessor Body tag definition in the model.
If a value is set for the tagged value of the C# Attributes tag definition, ACS generates the value as the attributes of the event.
If the tagged value of the C# Delegate Type tag definition references an Operation, ACS generates the value as type of the event.
If the tagged value of the C# Extern tag definition is set to True (and the Attribute is not abstract), ACS generates the event with the extern modifier.
If the tagged value of the C# Internal tag definition is set to Internal, ACS generates the event with the internal modifier. If a value of the C# Internal tag definition is set to Protected Internal, ACS generates the event with the protected internal modifiers.
If the tagged value of the C# Needs Qualified Type tag definition is set to True, ACS generates the event's type (Operation) using its fully qualified name, rather than its unqualified name.
If the tagged value of the C# New tag definition is set to True, ACS generates the new keyword when appropriate.
If the tagged value of the C# Overridetag definition is set to True (and the Attribute is virtual with on instance storage), ACS generates the event with the override modifier.
If a value is set for the tagged value of the C# Remove Accessor Attributes tag definition, ACS generates the value on the line before the Remove statement as the attributes of the remove accessor declaration.
If a value is set for the tagged value of the C# Remove Accessor Body tag definition, ACS generates the value as the body code of the remove accessor declaration.
If reverse engineering is enabled in ACS, you can change the body code of the remove accessor in the code file and ACS will update the tagged value of the C# Add Accessor Body tag definition in the model.
If the tagged value of the C# Sealed tag definition is set to True (and the Attribute is override and not abstract), ACS generates the event with the sealed modifier.
If the tagged value of the C# Unsafe tag definition is set to True, ACS generates the event with the Unsafe modifier.
If the tagged value of the C# Virtual tag definition is set to True (and the Attribute is not abstract or override, and has on instance storage), ACS generates the event with the Virtual modifier.
For Fields
If the «C# Field» stereotype is applied to an Attribute, ACS generates the Attribute as a field. The «C# Field» stereotype applies the following Tag Definitions to an Attribute:
If the type of the field is a generic type, ACS generates the tagged value of the C# Actual Parameters tag definition as the type arguments for that generic type.
If a value is set for the tagged value of the C# Attributes tag definition, ACS generates the value as the attributes of the field.
If the tagged value of the C# Delegate Type tag definition references an Operation, ACS generates the value as type of the field.
If the tagged value of the C# Internal tag definition is set to Internal, ACS generates the field with the internal modifier. If a value of the C# Internal tag definition is set to Protected Internal, ACS generates the field with the protected internal modifiers.
If the tagged value of the C# Needs Qualified Type tag definition is set to True, ACS generates the field's type using its fully qualified name, rather than its unqualified name.
If the tagged value of the C# New tag definition is set to True, ACS generates the new keyword when appropriate.
The C# Read Only tag definition is not used at present. Use the Modeler Read Only property to generate the Read only modifier.
If the tagged value of the C# Unsafe tag definition is set to True, ACS generates the field with the Unsafe modifier.
If the tagged value of the C# Volatile tag definition is set to True, ACS generates the field with the Volatile modifier.
For Fixed Size Buffers
If the «C# Fixed Size Buffer» stereotype is applied to an Attribute, ACS generates the Attribute as a fixed size buffer. When defining a Fixed Size Buffer, set its Multiplicity to User Defined and specify the size of the buffer. The «C# Fixed Size Buffer» stereotype applies the following Tag Definitions to an Attribute:
If the tagged value of the C# Internal tag definition is set to Internal, ACS generates the fixed size buffer with the internal modifier.
If the tagged value of the C# Internal tag definition is set to Protected Internal, ACS generates the fixed size buffer with the protected internal modifiers.
If the tagged value of the C# New tag definition is set to True, ACS generates the new keyword when appropriate.
If the tagged value of the C# Unsafetag definition is set to True, ACS generates the fixed size buffer with the Unsafe modifier.
For Properties
If the «C# Property» stereotype is applied to an Attribute, ACS generates the Attribute as a property member.
* 
ACS generates a property only after a tagged value is set for either the C# Get Accessor Body or C# Set Accessor Body tag definition.
The «C# Property» stereotype applies the following Tag Definitions to an Attribute:
If the tagged value of the C# Abstract tag definition is set to True (and the Attribute is not virtual, sealed or extern, and has on instance Storage), ACS generates the property member with the abstract modifier, assuming that the owning Class, Data Type or Signal is abstract
If the type of the property member is a generic type, ACS generates the tagged value of the C# Actual Parameters tag definition as the type arguments for that generic type.
If a value is set for the tagged value of the C# Attributes tag definition, ACS generates the value as the attributes of the property member.
If the tagged value of the C# Delegate Type tag definition references an Operation, ACS generates the value as type of the property.
If the tagged value of the C# Externtag definition is set to True (and the Attribute is not abstract), ACS generates the property member with the extern modifier.
If a value is set for the tagged value of the C# Get Accessor Attributes tag definition, ACS generates the value on the line before the Get statement as the attributes of the get accessor declaration.
If a value is set for the tagged value of the C# Get Accessor Body tag definition, ACS generates the value as the body code of the get accessor declaration.
If reverse engineering is enabled in ACS, you can change the body code of the get accessor in the code file and ACS will update the tagged value of the C# Get Accessor Body tag definition in the model.
If the value of the C# Get Accessor Modifiers tag definition is not set to none, ACS generates the value as the modifiers of the get accessor declaration.
If the tagged value of the C# Internal tag definition is set to Internal, ACS generates the property member with the internal modifier. If a value of the C# Internal tag definition is set to Protected Internal, ACS generates the property member with the protected internal modifiers.
If the tagged value of the C# Needs Qualified Type tag definition is set to True, ACS generates the property's type using its fully qualified name, rather than its unqualified name.
If the tagged value of the C# New tag definition is set to True, ACS generates the new keyword when appropriate.
If the tagged value of the C# Override tag definition is set to True (and the Attribute is virtual with on instance storage), ACS generates the property member with the override modifier.
If the tagged value of the C# Sealed tag definition is set to True (and the Attribute is virtual with on instance storage), ACS generates the property member with the sealed modifier.
If a value is set for the tagged value of the C# Set Accessor Attributes tag definition, ACS generates the value on the line before the Set statement as the attributes of the set accessor declaration.
If a value is set for the tagged value of the C# Set Accessor Body tag definition, ACS generates the value as the body code of the set accessor declaration.
If reverse engineering is enabled in ACS, you can change the body code of the set accessor in the code file and ACS will update the tagged value of the C# Set Accessor Body tag definition in the model.
If the value of the C# Set Accessor Modifiers tag definition is not set to none, ACS generates the value as the modifiers of the set accessor declaration.
If the tagged value of the C# Unsafe tag definition is set to True, ACS generates the property member with the Unsafe modifier.
If the tagged value of the C# Virtualtag definition is set to True (and the Attribute is not abstract or override, and has on instance storage), ACS generates the property member with the virtual modifie
Was this helpful?