Working with Attributes

  • Updated

Prerequisites: A valid EntityDef and FieldDef
Namespaces: InRule.Repository
Classes: EntityDef, FieldDef
See Also: Creating a RuleSession, Retrieving Definition Objects at Runtime

Retrieve a user-defined attribute on an entity

// Retrieve an attribute defined on an entity
Console.WriteLine(entityDef.Attributes.Default["MyAttribute"]);

Iterate through the attributes on a field

if (fieldDef.Attributes != null && fieldDef.Attributes.Count > 0)
{
  foreach (XmlSerializableStringDictionary.XmlSerializableStringDictionaryItem attributeItem
in fieldDef.Attributes.Default)
   {
      Console.WriteLine(attributeItem.Key + ":" + attributeItem.Value);
   }
}

Was this article helpful?

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.