Hi,

The online manual indicates that it is possible to open a transaction with a [Transactional] attribute (see http://wiki.dataobjects.net/index.php?t ... ansactions )

However, the [Transactional] attribute does not seem to exist in DO 4.0.5. The only similar class I found in the source code is Xtensive.Storage.Aspects.TransactionalAspect, but unfortunately the class is internal.

Has the [Transactional] attribute ever existed in previous versions of DataObjects 4.X ? If so, why has it been removed ?

From my understanding, the only alternative is to use :

using (var transactionScope = Transaction.Open()) {
  // Transactional operation runs here
  transactionScope.Complete();
}

Is this correct ?

Best regards,

Auguste

This thread was imported from our support forum. The original discussion may contain more detailed answer.

asked Sep 04 '09 at 16:09

Auguste's gravatar image

Auguste
25888


One Answer:

You're right, [Transactional] is obsolete from v4.0.5. Wiki will be fixed.

Use [AspectBehavior] attribute instead. Examples:

[AspectBehavior(true)] // will activate Session & open transaction [AspectBehavior(OpenTransaction = true)] // will only open transaction [AspectBehavior(OpenSession = true)] // will only activate session

Btw, you must consider that [AspectBehavior(true)] is applied automatically to all public methods & properties of any SessionBound ancestor. If you want to disable this for a particular public method, use either [AspectBehavior(false)] or [Infrastructure] (suppresses all the aspects).

P.S. Your code with opening a transaction is correct, so it can be used as well.

answered Sep 04 '09 at 20:58

Alex%20Yakunin's gravatar image

Alex Yakunin
29714412

Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

Subscription:

Once you sign in you will be able to subscribe for any updates here

Tags:

×573

Asked: Sep 04 '09 at 16:09

Seen: 2,119 times

Last updated: Sep 04 '09 at 16:09

powered by OSQA