Skip to content

Commit

Permalink
Fixing load using value type for sharded sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
ayende committed Dec 11, 2011
1 parent 53614e0 commit 1f9ecae
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Raven.Client.Lightweight/Shard/ShardedDocumentSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,8 @@ public T[] Load<T>(IEnumerable<string> ids)
/// </remarks>
public T Load<T>(ValueType id)
{
var documentKey = Conventions.FindFullDocumentKeyFromNonStringIdentifier(id, typeof(T), false);
// assuming all conventions are the same
var documentKey = shardSessions.First().Advanced.DocumentStore.Conventions.FindFullDocumentKeyFromNonStringIdentifier(id, typeof(T), false);
return Load<T>(documentKey);
}

Expand Down
15 changes: 15 additions & 0 deletions Raven.Tests/Shard/When_Using_Sharded_Servers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,21 @@ public void Can_override_the_shard_id_generation()
}
}

[Fact]
public void Can_query_using_int()
{
shardStrategy.Stub(x => x.ShardAccessStrategy).Return(new SequentialShardAccessStrategy());
using (var documentStore = new ShardedDocumentStore(shardStrategy, shards))
{
documentStore.Initialize();

using (var session = documentStore.OpenSession())
{
session.Load<Company>(1);
}
}
}

[Fact]
public void Can_insert_into_two_sharded_servers()
{
Expand Down

0 comments on commit 1f9ecae

Please sign in to comment.