Skip to content

Commit

Permalink
Merge pull request #2127 from ppekrol/master
Browse files Browse the repository at this point in the history
RavenDB-3389 OpenAsyncSession is missing the OpenSessionOptions overload
  • Loading branch information
ayende committed Apr 15, 2015
2 parents 57a5ad0 + d176221 commit 3d5ab78
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Raven.Client.Lightweight/Document/DocumentStore.cs
Expand Up @@ -797,7 +797,7 @@ public override IAsyncDocumentSession OpenAsyncSession(string databaseName)
});
}

public IAsyncDocumentSession OpenAsyncSession(OpenSessionOptions options)
public override IAsyncDocumentSession OpenAsyncSession(OpenSessionOptions options)
{
return OpenAsyncSessionInternal(options);
}
Expand Down
1 change: 1 addition & 0 deletions Raven.Client.Lightweight/DocumentStoreBase.cs
Expand Up @@ -83,6 +83,7 @@ public void SetListeners(DocumentSessionListeners newListeners)
public abstract IAsyncDatabaseCommands AsyncDatabaseCommands { get; }
public abstract IAsyncDocumentSession OpenAsyncSession();
public abstract IAsyncDocumentSession OpenAsyncSession(string database);
public abstract IAsyncDocumentSession OpenAsyncSession(OpenSessionOptions sessionOptions);

public abstract IDocumentSession OpenSession();
public abstract IDocumentSession OpenSession(string database);
Expand Down
5 changes: 5 additions & 0 deletions Raven.Client.Lightweight/IDocumentStore.cs
Expand Up @@ -112,6 +112,11 @@ public interface IDocumentStore : IDisposalNotification
/// <returns></returns>
IAsyncDocumentSession OpenAsyncSession(string database);

/// <summary>
/// Opens the async session with the specified options.
/// </summary>
IAsyncDocumentSession OpenAsyncSession(OpenSessionOptions sessionOptions);

/// <summary>
/// Opens the session.
/// </summary>
Expand Down
8 changes: 8 additions & 0 deletions Raven.Client.Lightweight/Shard/ShardedDocumentStore.cs
Expand Up @@ -130,6 +130,14 @@ public override IAsyncDocumentSession OpenAsyncSession(string databaseName)
return OpenAsyncSessionInternal(databaseName, ShardStrategy.Shards.ToDictionary(x => x.Key, x => x.Value.AsyncDatabaseCommands.ForDatabase(databaseName)));
}

/// <summary>
/// Opens the async session with the specified options.
/// </summary>
public override IAsyncDocumentSession OpenAsyncSession(OpenSessionOptions sessionOptions)
{
return OpenAsyncSessionInternal(sessionOptions.Database, ShardStrategy.Shards.ToDictionary(x => x.Key, x => x.Value.AsyncDatabaseCommands.ForDatabase(sessionOptions.Database).With(sessionOptions.Credentials)));
}

private IAsyncDocumentSession OpenAsyncSessionInternal(string dbName,Dictionary<string, IAsyncDatabaseCommands> shardDbCommands)
{
EnsureNotClosed();
Expand Down
7 changes: 6 additions & 1 deletion Raven.Database/Client/EmbeddableDocumentStore.cs
Expand Up @@ -287,7 +287,12 @@ public IAsyncDocumentSession OpenAsyncSession(string database)
return Inner.OpenAsyncSession(database);
}

public IDocumentSession OpenSession()
public IAsyncDocumentSession OpenAsyncSession(OpenSessionOptions sessionOptions)
{
return Inner.OpenAsyncSession(sessionOptions);
}

public IDocumentSession OpenSession()
{
return Inner.OpenSession();
}
Expand Down
10 changes: 9 additions & 1 deletion Raven.Database/Client/EmbeddedDocumentStore.cs
Expand Up @@ -252,7 +252,15 @@ public IAsyncDocumentSession OpenAsyncSession(string database)
return server.DocumentStore.OpenAsyncSession(database);
}

/// <summary>
/// <summary>
/// Opens the async session with the specified options.
/// </summary>
public IAsyncDocumentSession OpenAsyncSession(OpenSessionOptions sessionOptions)
{
return server.DocumentStore.OpenAsyncSession(sessionOptions);
}

/// <summary>
/// Opens the session.
/// </summary>
/// <returns></returns>
Expand Down

0 comments on commit 3d5ab78

Please sign in to comment.