Using NRules, I want to be able to create a session, insert facts, have it fire and complete, and while the session is still alive in memory (static variable) I want to call an update on the fact.
private static ISession session; //this is instantiated when bulding the rules dinamically
public void RulesTest(RulesTest command)
{
//entities holds ALL facts ever inserted in session
var entities = _session.Query<Entity>();
_session.Insert(command.Fact);
Rule rule = GetRule();
_session.Insert(rule.Condition);
_session.Insert(rule.Action);
_session.Fire();
}
This fires the rule and does everything properly. What I want now to happen is to add the capibility of being able to update the SAME FACT that was fired once, but now with a new value...meaning, I want to update the fact, and have it run through the conditions again.
Doing _session.Update(command.Fact)
after updating my fact gives me an error message: "Fact for update does not exist", even though I can see ALL facts still in session.
Any idea is welcome. Thank you.