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.4.3.0
Syntax
C#
public interface ISession

The ISession type exposes the following members.

Properties
  NameDescription
Public propertyDependencyResolver
Rules dependency resolver.
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 methodInsert
Inserts a new fact 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 methodTryInsert
Inserts a fact to the rules engine memory if the fact does not exist.
Public methodTryRetract
Removes a fact from the rules engine memory if the fact exists.
Public methodTryUpdate
Updates a fact in the rules engine memory if the fact exists.
Public methodUpdate
Updates existing fact 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.
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.
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