Prerequisites: A valid RuleSession, A valid Entity
Namespaces: InRule.Runtime
Classes: RuleSession, Entity
See Also: Retrieving a Rule Application, Creating a RuleSession, Creating Entities
To retrieve an Entity from the RuleSession, use the GetEntity() method. The input to GetEntity() may contain either the Element ID or the Instance ID, if one has been assigned.
If no Entity is found, GetEntity() returns null.
Obtain the Element ID
// Obtain the Element ID to lookup the Entity from the RuleSession at a later point
string elementId = ruleSession.CreateEntity("Invoice").ElementId;
Retrieve the Entity using the Element ID
// Get the Entity from the RuleSession using the Element ID
Entity entity = ruleSession.GetEntity(elementId);
if (entity == null)
{
// Entity was not found
}
Retrieve the Entity using an Instance ID
// Get the Entity from the RuleSession using the Element ID
Entity entity = ruleSession.GetEntity("Invoice175941");
if (entity == null)
{
// Entity was not found
}
Comments
0 comments
Please sign in to leave a comment.