# AObjectBase Class

Namespace: `ArchestrA.Toolkit`

AObjectBase class is the base class of the ConfigtimeBase and RuntimeBase classes.

Provides common functionality for configtime and runtime classes like Dictionary access, Logger access, Attribute Get and Put, Register and Unregister of Configtime/Runtime sethandlers.

**Syntax**

```csharp
public class AObjectBase : _APrimitiveBase
```

## AObjectBase Properties

### AObjectInstance Property

Provides access to set/get the instance of the object class.

**Syntax**

```csharp
public object AObjectInstance { get; set; }
```

**Returns**

object

### ClassName Property

Provides access to the name of the object class.

**Syntax**

```csharp
public string ClassName { get; }
```

**Returns**

string

### DictionaryInstance Property

Provides access to the Dictionary for this object.

**Syntax**

```csharp
public Dictionary DictionaryInstance { get; }
```

**Returns**

Dictionary

### MajorVersion Property

Provides access to the major version of this object.

**Syntax**

```csharp
public string MajorVersion { get; }
```

**Returns**

string

### MinorVersion Property

Provides access to the minor version of this object.

**Syntax**

```csharp
public string MinorVersion { get; }
```

**Returns**

string

### Runtime Property

Provides indication if the object is currently in runtime or configtime.

**Syntax**

```csharp
public bool Runtime { get; }
```

**Returns**

bool

true: when executing in runtime code.

false: when executing in configtime code.

### Tagname Property

Provides access to the Tagname of the object.

**Syntax**

```csharp
public string Tagname { get; }
```

**Returns**

string

## AObjectBase Methods

### AddErrorMessage Method

Provides a method to add an error message to the site.

**Syntax**

```csharp
public void AddErrorMessage(string message);
```

**Parameters**

**`message`**

string value that holds the message.

### AddWarningMessage Method

Provides a method to add a warning message to the site.

**Syntax**

```csharp
public void AddWarningMessage(string message);
```

**Parameters**

**`message`**

string value that holds the message.

### AttributeExists Method

Provides a method to check the existence of an Attribute by name.

**Syntax**

```csharp
public bool AttributeExists(string fullName);
```

**Parameters**

**`fullName`**

Attribute external name.

**Returns**

bool

### FormatError Method (Exception)

Provides a method to generate a formatted exception string from an exception.

**Syntax**

```csharp
protected string FormatError(Exception ex);
```

**Parameters**

**`ex`**

Exception value to be formatted.

**Returns**

string

### FormatError Method (string, Exception)

Provides a detailed method to generate a formatted exception string from an exception and add additional information to the exception string.

**Syntax**

```csharp
protected string FormatError(
string localMessage,
Exception ex
);
```

**Parameters**

**`localMessage`**

Additional information to add to the exception message.

**`ex`**

Exception value to be formatted.

**Returns**

string

This is a concatenation of the localMessage string and the formatted exception string.

### Get Method (string, EATTRIBUTEPROPERTY)

Provides a method to get the value of an Attribute’s property by name.

**Syntax**

```csharp
public CMxValue Get(
string fullName,
EATTRIBUTEPROPERTY property
);
```

**Parameters**

**`fullName`**

Attribute external name.

**`property`**

Attribute property to access.

**Returns**

CMxValue

### Get Method (short, short, EATTRIBUTEPROPERTY)

Provides a method to get the value of an Attribute’s property by ID and primitive ID.

**Syntax**

```csharp
public CMxValue Get(
short attributeId,
short primitiveId,
EATTRIBUTEPROPERTY propertyId
);
```

**Parameters**

**`attributeId`**

Attribute ID.

**`primitiveId`**

Primitive ID.

**`propertyId`**

Attribute property to access.

**Returns**

CMxValue

### GetAttributeHandle Method

Provides a method to get an Attribute handle by name.

**Syntax**

```csharp
public AttributeHandle GetAttributeHandle(string fullName);
```

**Parameters**

**`fullName`**

Attribute external name.

**Returns**

AttributeHandle

### GetIsLocked Method (string)

Provides a method to get the Lock Status of an attribute by name.

**Syntax**

```csharp
public bool GetIsLocked(string fullName);
```

**Parameters**

**`fullName`**

Attribute external name.

**Returns**

bool

true: if the attribute is locked.

false: if the attribute is unlocked.

### GetIsLocked Method (short, short)

Provides a method to get the Lock Status of an attribute by ID and primitive ID.

**Syntax**

```csharp
public bool GetIsLocked(
short attributeId,
short primitiveId
);
```

**Parameters**

**`attributeId`**

Attribute ID.

**`primitiveId`**

Primitive ID.

**Returns**

bool

true: if the attribute is locked.

false: if the attribute is unlocked.

### GetName Method

Provides a method to get the name of an attribute by ID and primitive ID.

**Syntax**

```csharp
public string GetName(
short attributeId,
short primitiveId
);
```

**Parameters**

**`attributeId`**

Attribute ID.

**`primitiveId`**

Primitive ID.

**Returns**

string

### GetNumElements Method (string)

Provides a method to get the number of elements of an attribute by name.

**Syntax**

```csharp
public int GetNumElements(string fullName);
```

**Parameters**

**`fullName`**

Attribute external name.

**Returns**

int

Returns -1 in case of a non-array attribute.

### GetNumElements Method (short, short)

Provides a method to get the number of elements of an attribute by ID and primitive ID.

**Syntax**

```csharp
public int GetNumElements(
short attributeId,
short primitiveId
);
```

**Parameters**

**`attributeId`**

Attribute ID.

**`primitiveId`**

Primitive ID.

**Returns**

int

Returns -1 in case of a non-array attribute.

### GetPrimitiveID Method

Provides a method to get a primitive ID by name.

**Syntax**

```csharp
public short GetPrimitiveID(string primName);
```

**Parameters**

**`primName`**

Primitive internal name.

**Returns**

short

### GetSecurityClassification Method (string)

Provides a method to get the Security Classification of an attribute by name.

**Syntax**

```csharp
public MxSecurityClassification GetSecurityClassification(string fullName);
```

**Parameters**

**`fullName`**

Attribute external name.

**Returns**

MxSecurityClassification

### GetSecurityClassification Method (short, short)

Provides a method to get the Security Classification of an attribute by ID and primitive ID.

**Syntax**

```csharp
public MxSecurityClassification GetSecurityClassification(
short attributeId,
short primitiveId
);
```

**Parameters**

**`attributeId`**

Attribute ID.

**`primitiveId`**

Primitive ID.

**Returns**

MxSecurityClassification

### GetText Method (int)

Provides a method to get a string from the dictionary by int ID.

**Syntax**

```csharp
public string GetText(int phraseId);
```

**Parameters**

**`phraseId`**

PhraseId that exists in the dictionary.

**Returns**

string

### GetText Method (string)

Provides a method to get a string from the dictionary by string ID.

**Syntax**

```csharp
public string GetText(string phraseId);
```

**Parameters**

**`phraseId`**

PhraseId that exists in the dictionary.

**Returns**

string

### GetType Method (string)

Provides a method to get the type of an attribute by name.

**Syntax**

```csharp
public MxDataType GetType(string fullName);
```

**Parameters**

**`fullName`**

Attribute external name.

**Returns**

MxDataType

### GetType Method (short, short)

Provides a method to get the type of an attribute by ID and primitive ID.

**Syntax**

```csharp
public MxDataType GetType(
short attributeId,
short primitiveId
);
```

**Parameters**

**`attributeId`**

Attribute ID.

**`primitiveId`**

Primitive ID.

**Returns**

MxDataType

### GetValue Method (string)

Provides a method to get the value of an Attribute by name.

**Syntax**

```csharp
public CMxValue GetValue(string fullName);
```

**Parameters**

**`fullName`**

Attribute external name.

**Returns**

CMxValue

### GetValue Method (short, short)

Provides a method to get the value of an Attribute by attribute ID and primitive ID.

**Syntax**

```csharp
public CMxValue GetValue(
short attributeId,
short primitiveId
);
```

**Parameters**

**`attributeId`**

Attribute ID.

**`primitiveId`**

Primitive ID.

**Returns**

CMxValue

### LogError Method

Provides a method to write an error message to the logger.

**Syntax**

```csharp
public void LogError(string _message);
```

**Parameters**

**`_message`**

string value that holds the error message to be logged.

### LogException Method

Provides a method to write a formatted exception to the logger.

**Syntax**

```csharp
public void LogException(Exception ex);
```

**Parameters**

**`ex`**

Exception value to be logged.

### LogInfo Method

Provides a method to write an information message to the logger.

**Syntax**

```csharp
public void LogInfo(string _message);
```

**Parameters**

**`_message`**

string value that holds information to be logged.

### LogTrace Method

Provides a method to write a trace message to the logger.

**Syntax**

```csharp
public void LogTrace(string _message);
```

**Parameters**

**`_message`**

string value that holds trace message to be logged.

### LogWarning Method

Provides a method to write a warning message to the logger.

**Syntax**

```csharp
public void LogWarning(string _message);
```

**Parameters**

**`_message`**

string value that holds warning message to be logged.

### RegisterConfigtimeSetHandler Method

Provides a method to register the configtime set handler of an Attribute by name.

**Syntax**

```csharp
public void RegisterConfigtimeSetHandler(
string _attrName,
ConfigtimeSetHandlerDelegate _handler
);
```

**Parameters**

**`_attrName`**

Attribute external name.

**`_handler`**

Handle of configtime set handler delegate.

### RegisterRuntimeSetHandler Method

Provides a method to register a runtime set handler to an Attribute by name.

**Syntax**

```csharp
public void RegisterRuntimeSetHandler(
string attrName,
RuntimeSetHandlerDelegate handler
);
```

**Parameters**

**`attrName`**

Attribute external name.

**`handler`**

Handle of runtime set handler delegate.

### Set Method (string, EATTRIBUTEPROPERTY, object)

Provides a method to set the value of a property of an Attribute by Attribute name.

**Syntax**

```csharp
public void Set(
string fullName,
EATTRIBUTEPROPERTY property,
object value
);
```

**Parameters**

**`fullName`**

Attribute external name.

**`property`**

Property type.

**`value`**

Value to set.

### Set Method (short, short, EATTRIBUTEPROPERTY, CMxValue)

Provides a method to set the value of a property of an Attribute by ID and primitive ID.

**Syntax**

```csharp
public void Set(
short attributeId,
short primitiveId,
EATTRIBUTEPROPERTY propertyId,
CMxValue val
);
```

**Parameters**

**`attributeId`**

Attribute ID.

**`primitiveId`**

Primitive ID.

**`propertyId`**

Property type.

**`val`**

Value to set.

### SetNumElements Method (string, int)

Provides a method to set the number of elements of an Attribute by name.

**Syntax**

```csharp
public void SetNumElements(
string fullName,
int numElements
);
```

**Parameters**

**`fullName`**

Attribute external name.

**`numElements`**

Number of elements to set.

### SetNumElements Method (short, short, int)

Provides a method to set the number of elements of an Attribute by ID and primitive ID.

**Syntax**

```csharp
public void SetNumElements(
short attributeId,
short primitiveId,
int numElements
);
```

**Parameters**

**`attributeId`**

Attribute ID.

**`primitiveId`**

Primitive ID.

**`numElements`**

Number of elements to set.

### SetValue Method (string, object)

Provides a method to set the value of an Attribute by name.

**Syntax**

```csharp
public void SetValue(
string fullName,
object value
);
```

**Parameters**

**`fullName`**

Attribute external name.

**`value`**

Value to set.

### SetValue Method (short, short, CMxValue)

Provides a method to set the value of an Attribute by attribute Id and primitive Id.

**Syntax**

```csharp
public void SetValue(
short attributeId,
short primitiveId,
CMxValue val
);
```

**Parameters**

**`attributeId`**

Attribute ID.

**`primitiveId`**

Primitive ID.

**`val`**

Value to set.

### StoreObject Method

Provides a method to encode a C# object into a custom structure.

**Syntax**

```csharp
public MxCustomStruct StoreObject(
int id,
object obj
);
```

**Parameters**

**`id`**

ID of the CustomStruct.

**`obj`**

C# object to be stored.

**Returns**

MxCustomStruct

### UnregisterConfigtimeSetHandler Method

Provides a method to unregister the configtime set handler of an Attribute by name.

**Syntax**

```csharp
public void UnregisterConfigtimeSetHandler(string _attrName);
```

**Parameters**

**`_attrName`**

Attribute external name.

### UnregisterRuntimeSetHandler Method

Provides a method to unregister the runtime set handler of an Attribute by name.

**Syntax**

```csharp
public void UnregisterRuntimeSetHandler(string attrName);
```

**Parameters**

**`attrName`**

Attribute external name.
