Click or drag to resize

ISessionFactory Interface

Represents compiled production rules that can be used to create rules sessions. Created by RuleCompiler by compiling rule model into an executable form.

Namespace:  NRules
Assembly:  NRules (in NRules.dll) Version: 0.8.4
public interface ISessionFactory

The ISessionFactory type exposes the following members.

Public propertyActionInterceptor
Action interceptor for all rules sessions. If provided, invocation of rule actions is delegated to the interceptor.
Public propertyDependencyResolver
Rules dependency resolver for all rules sessions.
Public propertyEvents
Provider of events aggregated across all rule sessions. Event sender is used to convey the session instance responsible for the event. Use it to subscribe to various rules engine lifecycle 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.
Session factory is expensive to create (because rules need to be compiled into an executable form). Therefore there needs to be only a single instance of session factory for a given set of rules for the lifetime of the application. If repeatedly running rules for different sets of facts, don't create a new session factory for each rules run. Instead, have a single session factory and create a new rules session for each independent universe of facts.
Thread Safety
Instance members of this type are safe for multi-threaded operations.
See Also