在此代碼中,在IndexQuery
,PatchRequest
和PatchCommandType
下面有一條紅色波浪線,表示沒有導入正確的名稱空間。 我需要導入什麼名稱空間?我需要導入什麼命名空間才能獲得RavenDB類型'IndexQuery'?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Raven.Client.Document;
...
documentStore.DatabaseCommands.UpdateByIndex("DataByColor",
new IndexQuery
{
Query = "Color:red"
}, new[]
{
new PatchReques
{
Type = PatchCommandType.Set,
Name = "Color",
Value = "Green"
}
},
allowStale: false);
在Visual Studio中,如果將光標放在類名上並按下ctrl-。 (控制期),它會給你一個建議命名空間的列表。不知道這是否適用於.NET框架之外的名稱空間/程序集,但我發現它非常有用。 – Tim