Xafari Service. Activation and Deactivation
All services can be activated/deactivated the same as XAF Controllers. Use the XafariCommonService.Active property to do it.
By default, a service is not activated until its registration and initialization. To activate a service that has dependencies on a particular user, the successful Logon operation of that user is needed.
When a service is deactivated, its functions and methods are disabled and do not perform anything. The context service operations—including CommitChanges(), Reload(), and Rollback()—cannot be executed, as well.
No exceptions are generated when using a deactivated service.
In its normal state, the service is usually active. However, there may be some reasons to deactivate it. It is possible to manage the activity of the service globally (for the whole application and influencing all operations that execute) or locally. It is recommended to use the ActiveScope object to deactivate services locally.
public void SomeMethod()
using (var objectSpace = this.CreateObjectSpace())
var objs = objectSpace.Xafari().GetObjects<SystemObject1>();
Public Sub SomeMethod()
Using objectSpace = Me.CreateObjectSpace()
Dim objs = objectSpace.Xafari().GetObjects(Of SystemObject1)()