Permalink
Browse files

Fixing load using value type for sharded sessions

  • Loading branch information...
1 parent 53614e0 commit 1f9ecaecbdcaa1d7350cea5f76371d9558856a9f @ayende ayende committed Dec 11, 2011
@@ -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);
}
@@ -98,6 +98,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()
{
using (var documentStore = new ShardedDocumentStore(shardStrategy, shards))

0 comments on commit 1f9ecae

Please sign in to comment.