For the following code

using (Xtensive.Storage.Session.Open(doc.D4.domain)) using (var t = Xtensive.Storage.Transaction.Open()) {
      ..........
      t.Complete();
}

I get the following error:

'Xtensive.Storage.TransactionScope' does not contain a definition for 'Complete' and no extension method 'Complete' accepting a first argument of type 'Xtensive.Storage.TransactionScope' could be found (are you missing a using directive or an assembly reference?)

when I put in

using Xtensive.Storage;

and remove Xtensive.Storage. from the code, no errors.

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

asked Jul 28 '09 at 00:59

Editor's gravatar image

Editor
46154156157


One Answer:

That's because Complete is extension method defined in TransactionScopeExtensions.

Why it is implemented as an extension method? Transaction.Open may return null if there is already opened transaction. "using" block in C# understands this case, but ts.Complete() would fail.

Why Transaction.Open returns null? Well, this is the fastest way to say "do nothing, it's already open". No allocations = better performance.

answered Jul 28 '09 at 05:17

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:

×574

Asked: Jul 28 '09 at 00:59

Seen: 2,816 times

Last updated: Jul 28 '09 at 00:59

powered by OSQA