-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
Description
The XComponent Runtime supports natively lambda expressions to filter state machines instances according their public members properties. The idea of this feature is to extend the GetSnapshot method to add this lambda expression.
Example:
Imagine a public member with the property "Id".
We want all state machines matching a specific Id:
myComponentStm.GetSnapshot("Id == 1234")
The filter can be checked with the following code:
public static void CheckFilter(string filter) where T : class
{
try
{
var dynamicExpression = System.Linq.Dynamic.DynamicExpression.ParseLambda(new[] { Expression.Parameter(typeof(T)) }, typeof(bool), filter, new object[0]);
dynamicExpression.Compile();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}