Hi, Our code is used in several places like: The web, A background service, a standalone application. Now we would like to be able to use just 1 code base for that. On the web we use the SessionManager which creates a Session and a transaction for us and handles all failures and successes. So when we enter our code a Session and a Transaction are active. When however we enter our code from for instance a background service this is not the case. No Session and Transaction are active so we have to do this ourselves. I would like to automate this process and make it transparent for the developer. For that I need to know if a Sesseion and Transaction are active or not and act accordingly. Is there a way to achieve that? Regards Paul |
I created the class below to solve this for the moment. With it I can do the following:
or
which automatically saves and commits any changes
|
This coding tell us that how to detect transaction easily through learning some programming skills. But i can't understand why you use Xtensive.Orm session for it. |