Click or drag to resize

ISession Interface

Represents a rules engine session. Created by ISessionFactory. Each session has its own working memory, and exposes operations that manipulate facts in it, as well as fire matching rules.

Namespace:  NRules
Assembly:  NRules (in NRules.dll) Version: 0.8.4
Syntax
C#
public interface ISession

The ISession type exposes the following members.

Properties
  NameDescription
Public propertyActionInterceptor
Action interceptor for the current rules session. If provided, invocation of rule actions is delegated to the interceptor.
Public propertyAgenda
Agenda, which represents a store for rule matches.
Public propertyDependencyResolver
Rules dependency resolver for the current rules session.
Public propertyEvents
Provider of events from the current rule session. Use it to subscribe to various rules engine lifecycle events.
Top
Methods
  NameDescription
Public methodFire
Starts rules execution cycle. This method blocks until there are no more rules to fire.
Public methodFire(Int32)
Starts rules execution cycle. This method blocks until maximum number of rules fired or there are no more rules to fire.
Public methodInsert
Inserts new fact to the rules engine memory.
Public methodInsertAll
Inserts new facts to the rules engine memory.
Public methodQueryTFact
Creates a LINQ query to retrieve facts of a given type from the rules engine's memory.
Public methodRetract
Removes existing fact from the rules engine memory.
Public methodRetractAll
Removes existing facts from the rules engine memory.
Public methodTryInsert
Inserts a fact to the rules engine memory if the fact does not exist.
Public methodTryInsertAll
Inserts new facts to the rules engine memory if the facts don't exist. If any of the facts exists in the engine, none of the facts are inserted.
Public methodTryRetract
Removes a fact from the rules engine memory if the fact exists.
Public methodTryRetractAll
Removes existing facts from the rules engine memory if the facts exist. If any of the facts don't exist in the engine, none of the facts are removed.
Public methodTryUpdate
Updates a fact in the rules engine memory if the fact exists.
Public methodTryUpdateAll
Updates existing facts in the rules engine memory if the facts exist. If any of the facts don't exist in the engine, none of the facts are updated.
Public methodUpdate
Updates existing fact in the rules engine memory.
Public methodUpdateAll
Updates existing facts in the rules engine memory.
Top
Events
Event TypeReason
IEventProviderFactInsertingEventBefore processing fact insertion.
IEventProviderFactInsertedEventAfter processing fact insertion.
IEventProviderFactUpdatingEventBefore processing fact update.
IEventProviderFactUpdatedEventAfter processing fact update.
IEventProviderFactRetractingEventBefore processing fact retraction.
IEventProviderFactRetractedEventAfter processing fact retraction.
IEventProviderActivationCreatedEventWhen a set of facts matches a rule.
IEventProviderActivationUpdatedEventWhen a set of facts is updated and re-matches a rule.
IEventProviderActivationDeletedEventWhen a set of facts no longer matches a rule.
IEventProviderRuleFiringEventBefore rule's actions are executed.
IEventProviderRuleFiredEventAfter rule's actions are executed.
IEventProviderConditionFailedEventWhen there is an error during condition evaluation, before throwing exception to the client.
IEventProviderBindingFailedEventWhen there is an error during binding expression evaluation, before throwing exception to the client.
IEventProviderAggregateFailedEventWhen there is an error during aggregate expression evaluation, before throwing exception to the client.
IEventProviderAgendaFilterFailedEventWhen there is an error during agenda filter evaluation, before throwing exception to the client.
IEventProviderActionFailedEventWhen there is an error during action evaluation, before throwing exception to the client.
Exceptions
ExceptionCondition
RuleConditionEvaluationExceptionError while evaluating any of the rules' conditions. This exception can also be observed as an event ConditionFailedEvent.
RuleExpressionEvaluationExceptionError while evaluating any of the rules' binding or aggregate expressions. This exception can also be observed as events BindingFailedEvent, AggregateFailedEvent.
AgendaExpressionEvaluationExceptionError while evaluating any of the agenda filters. This exception can also be observed as an event AgendaFilterFailedEvent.
RuleActionEvaluationExceptionError while evaluating any of the rules' actions. This exception can also be observed as an event ActionFailedEvent.
Thread Safety
Instance members of this type are not safe for multi-threaded operations.
See Also