Ejemplo n.º 1
0
 public Task<CompletableSynchronizedStorageSession> TryAdapt(TransportTransaction transportTransaction, ContextBag context)
 {
     SqlConnection existingSqlConnection;
     SqlTransaction existingSqlTransaction;
     //SQL server transport in native TX mode
     if (transportTransaction.TryGet(out existingSqlConnection) && transportTransaction.TryGet(out existingSqlTransaction))
     {
         CompletableSynchronizedStorageSession session = new StorageSession(existingSqlConnection, existingSqlTransaction, false);
         return Task.FromResult(session);
     }
     //Other modes handled by creating a new session.
     return EmptyResult;
 }
 public Task<CompletableSynchronizedStorageSession> TryAdapt(TransportTransaction transportTransaction, ContextBag context)
 {
     Transaction ambientTransaction;
     if (transportTransaction.TryGet(out ambientTransaction))
     {
         var session = context.GetAsyncSession();
         CompletableSynchronizedStorageSession completableSynchronizedStorageSession = new RavenDBSynchronizedStorageSession(session, true);
         return Task.FromResult(completableSynchronizedStorageSession);
     }
     return EmptyResult;
 }