Interface ISessionFactory
- Namespace
- NRules
- Assembly
- NRules.dll
Represents compiled production rules that can be used to create rules sessions. Created by RuleCompiler by compiling rule model into an executable form.
public interface ISessionFactory : ISessionSchemaProvider
- Inherited Members
Remarks
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.
Properties
ActionInterceptor
Action interceptor for all rules sessions. If provided, invocation of rule actions is delegated to the interceptor.
IActionInterceptor ActionInterceptor { get; set; }
Property Value
DependencyResolver
Rules dependency resolver for all rules sessions.
IDependencyResolver DependencyResolver { get; set; }
Property Value
Events
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.
IEventProvider Events { get; }
Property Value
Methods
CreateSession()
Creates a new rules session.
ISession CreateSession()
Returns
- ISession
New rules session.
CreateSession(Action<ISession>)
Creates a new rules session.
ISession CreateSession(Action<ISession> initializationAction)
Parameters
initializationAction
Action<ISession>Action invoked on the newly created session, before the session is activated (which could result in rule matches placed on the agenda).
Returns
- ISession
New rules session.