TP Example Code

This topic applies to .NET version only

Let's look at Transparent Persistence example. We will use SensorPanel class from Activation example, which represents a simple linked list.

First of all we must configure the database to use TP:

Now, we should explicitly store the objects that we want to be persistent:

In order to test if TP actually works, we will select all the SensorPanel objects from the database, modify them and commit the transaction. If TP took place the objects will be modified in the database:

The code above is ready to accommodate TP, however TP is not possible now as SensorPanel does not implement IActivatable interface. In the following chapter we will learn how to enable TP for the project classes in the build time.

The whole project code can be downloaded here: c#  vb