Click or drag to resize

IBusinessRulesServiceTModel Interface

Represents a service that executes business rules based on triggers which happen in the IRepositoryService layer

Namespace:  SanteDB.Core.Services
Assembly:  SanteDB.Core.Api (in SanteDB.Core.Api.dll) Version: 2.2.1
Syntax
public interface IBusinessRulesService<TModel> : IBusinessRulesService, 
	IServiceImplementation
where TModel : IdentifiedData

Type Parameters

TModel

[Missing <typeparam name="TModel"/> documentation for "T:SanteDB.Core.Services.IBusinessRulesService`1"]

The IBusinessRulesServiceTModel type exposes the following members.

Properties
  NameDescription
Public propertyNext
Gets or sets the rule to be run after this rule (for chained rules)
Public propertyServiceName
Gets the service name
(Inherited from IServiceImplementation.)
Top
Methods
  NameDescription
Public methodAfterInsert(TModel)
Called after an insert occurs.
Public methodAfterInsert(Object)
Called after an insert occurs
(Inherited from IBusinessRulesService.)
Public methodAfterObsolete(TModel)
Called after obsolete has been committed
Public methodAfterObsolete(Object)
Called after obsolete committed
(Inherited from IBusinessRulesService.)
Public methodAfterQuery(IEnumerableObject)
Called after query
(Inherited from IBusinessRulesService.)
Public methodAfterQuery(IEnumerableTModel)
Called after a query has been executed
Public methodAfterRetrieve(TModel)
Called after retrieve of an object
Public methodAfterRetrieve(Object)
Called after retrieve
(Inherited from IBusinessRulesService.)
Public methodAfterUpdate(TModel)
Called after update has been committed
Public methodAfterUpdate(Object)
Called after update committed
(Inherited from IBusinessRulesService.)
Public methodBeforeInsert(TModel)
Called before an insert occurs
Public methodBeforeInsert(Object)
Called before an insert occurs
(Inherited from IBusinessRulesService.)
Public methodBeforeObsolete(TModel)
Called before obsolete occurs
Public methodBeforeObsolete(Object)
Called before obsolete
(Inherited from IBusinessRulesService.)
Public methodBeforeUpdate(TModel)
Called before an update occurs
Public methodBeforeUpdate(Object)
Called before an update occurs
(Inherited from IBusinessRulesService.)
Public methodValidate(TModel)
Called to validate the data provided
Public methodValidate(Object)
Called to validate a specific object
(Inherited from IBusinessRulesService.)
Top
Remarks

When a business rules implementation is attached to the service context, or via the AddBusinessRule method, the SanteDB server call the appropiate Before/After functions on the implementation, before checking the Next property to follow the next business rule in the chain.

The JavaScript Business Rules Engine which loads data from installed applets is an example of an implementation of this service which translates events into Javascript callbacks. Implementers can use this service to:

  • Generate unique identifiers or other data and affix it to data
  • Intercept queries and write requests and perform re-writes
  • Log, catalog, or update external indexes of data
  • Cancel or interrupt the default flow of a persistence or query operation

Note: This can be done, instead with events on the persistence layer on the SanteDB datalayer, however there may come a time when a rule is fired without persistence occurring

See Also