2012-04-12 74 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