Persistate

Other events

Hide Navigation Pane

Other events

Previous topic Next topic No directory for this topic  

Other events

Previous topic Next topic Topic directory requires JavaScript JavaScript is required for the print function Mail us feedback on this topic!  

There are four events exposed by the Session class and a single event by the IndexedList<T> class used for persistent collections.  This topic gives a summary of what these events are for.  See the API documentation for details of these events.

Session events

The Session class represents a user session running a Persistate package, either as a stand-alone application, or in a Viewer-Server setup.

The Session.Committed event is raised immediately after every commit to persistent storage during the session.  This happens when you return an ExecutionResult with a ResultAction of Commit or CommitWarning from an operation execution method.  It also happens if you call Session.Commit() directly in your code.  This event is useful, for example, if you need to update a view class collection after making modifications which would affect its contents.
The Session.ResolveReference event is raised if the package running in the session performs a de-reference which failed.  This can happen for example if you have an association remaining to an object which was deleted.  If you subscribe to this event, you have the chance to avoid an exception by either supplying a replacement target object or a replacement reference.  The latter can be Reference.Empty.
The Session.SessionEnding event is raised whenever a session is about to terminate.  It is raised during the execution of the Exit operation, so any changes you make to persistent objects or collections in the event handler will be synchronised to persistent storage when that operation commits.  This event should be raised in all circumstances (barring a crash!), including when the Persistate Server service is stopped while sessions are still active.
The Session.TransactionListsUpdated event is raised whenever any of the "transaction" lists Persistate keeps for every session is altered.  These lists track new, modified and deleted objects and linkage changes, so this event is raised every time you make any change which will require synchronised to persistent storage.  It is also raised at the end of an operation execution if the lists are cleared after a commit or rollback.

IndexedList<T> event

The IndexedList<T> class is used for all persistent collections.

The IndexedList.Changed event is raised whenever the contents of the IndexedList changes, for whatever reason.  This includes when the IndexedList is filled or refreshed from persistent storage, and also includes calling the Clear method.  This method does not provoke any changes to persistent storage, so does not raise any of the other events such as Dissociated or Disowned which are raised when Remove or RemoveAll are called.  Persistate uses this event to update the display of grids portraying the collection in a user interface.