我正在玩蔚藍的Document Db,並且遇到了一個問題,或者對Ids感到困惑。我知道DocumentDb爲每個文檔生成一個「小寫」「id」屬性,這對我來說很好,但我似乎無法弄清楚如何在使用.net客戶端時獲得這個「id」。我的代碼看起來像下面Azure DocumentDb ID
public class Company
{
public Guid Id { get; set; } // this somehow does not get mapped to the "id" in the document.
public string Name { get; set; }
public string Address { get; set; }
}
所以當我查詢像
client.CreateDocumentQuery<Company>(collection.DocumentsLink).ToList();
ID屬性不被映射。我想我還沒有理解文檔db中的ID概念以及它如何正確地映射到實體。 任何幫助,非常感謝。
主要問題,當你的公司通過ID而不是ID修改的id屬性映射?沒有?所以,這不是你的ID。它是DocumentDb數據庫ID。 –
我試圖將它重命名爲小寫的ID它仍然不會將其重新。 –
我想......讓我們檢查一下是什麼錯誤。你能否修改你的源代碼問題? –