|
For the following code
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. |
|
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. |
