2012-04-12 75 views
0

我刚刚用RavenDB实现了分片。当运行它的第一次,这个代码:索引创建失败ShardedDocumentStore和Sharded Linq查询不支持

tempShardedDocumentStore = new ShardedDocumentStore(new ShardStrategy(), shards); 
tempShardedDocumentStore.Initialize(); 

IndexCreation.CreateIndexes(typeof(RavenDataAccess).Assembly, tempShardedDocumentStore); 

...产生此错误:

System.TypeInitializationException:为“WriteToRaven.Data的类型初始值。 RavenDataAccess'抛出一个异常。 ---> System.NotSupportedException:Sharded 文件存储没有数据库命令。你需要明确使用 碎片实例,以获得对数据库的访问命令

首先,ShardedDocumentStore确实有DatabaseCommands:

enter image description here

其次,如果只是将无法正常工作,它应该像这样做?

IndexCreation.CreateIndexes(typeof(RavenDataAccess).Assembly, shards[0]); 

如果是这样,现在我的LINQ查询将不工作:

System.NotSupportedException:分片LINQ查询当前不支持 在Raven.Client.Shard.ShardedDocumentSession.QueryT

using (IDocumentSession ravenSession = GetRavenSession()) 
{ 
    return ravenSession.Query<T>().OrderByDescending(orderByClause).FirstOrDefault(); 
} 

我如何得到这个工作?

注意:GetRavenSession()从上面显示的分片文档存储中返回OpenSession()。

回答

0

Bob Horn, 您使用的是什么构建?我们最近修改了分片支持。 我们现在支持linq在分片中,以及创建索引。

+0

我正在使用内部版本888. – 2012-04-14 15:35:07

+1

Ahhhhh ...我刚刚意识到我正在使用版本888作为服务器版本,但它看起来像使用旧的(701)客户端程序集。让我更新客户端程序集并查看... – 2012-04-14 15:37:01