How to check whether DbContext has transaction? : <p>Background:
I have WCF service with SimpleInjector as IoC which creates instance of DbContext per WCF request.</p>

<p>Backend itself is CQRS. CommandHandlers have a lot of decorators (validation, authorization, logging, some common rules for different handler groups etc) and one of them is Transaction Decorator:</p>

<pre><code>public class TransactionCommandHandlerDecorator&lt;TCommand&gt; : ICommandHandler&lt;TCommand&gt; 
    where TCommand : ICommand
{
    private readonly ICommandHandler&lt;TCommand&gt; _handler;
    private readonly IMyDbContext _context;
    private readonly IPrincipal _principal;

    public TransactionCommandHandlerDecorator(ICommandHandler&lt;TCommand&gt; handler,
        IMyDbContext context, IPrincipal principal)
    {
        _handler = handler;
        _context = context;
        _principal = principal;
    }

    void ICommandHandler&lt;TCommand&gt;.Handle(TCommand command)
    {
        using (var transaction = _context.Database.BeginTransaction())
        {
            try
            {
                var user = _context.User.Single(x =&gt; x.LoginName == _principal.Identity.Name);
                _handler.Handle(command);
                _context.SaveChangesWithinExplicitTransaction(user);
                transaction.Commit();
            }
            catch (Exception ex)
            {
                transaction.Rollback();
                throw;
            }
        }
    }
}
</code></pre>

<p>Problem occurs when any command tries to chain execute another command within the same WCF request. 
I got an expected exception at this line:</p>

<pre><code>using (var transaction = _context.Database.BeginTransaction())
</code></pre>

<p>because my DbContext instance already has a transaction.</p>

<p>Is there any way to check current transaction existence?</p>
