i have a class C, which inherits from A. Now i want to write a Rules, that matches on type A. So I tried the following code:
public class tmp : Rule
{
public override void Define()
{
A t = null;
When().Match<A>(() => t);
Then().Do(ctx => Console.WriteLine("test"));
}
}
But this don't work. Can anyone explain, how I can fix this issue? This doesnt work.
Best regards
Matching on the parent class definitely does work in NRules. Here is a full working example.
If you post the rest of your code, I can update this answer and show where the issue is. Maybe you didn't insert the fact into the session, or maybe you didn't call the
Fire
method, or maybe you didn't include the rule when compiling the session factory.