RavenDB 在什么条件下存储 class 实例的变量?

Under what conditions does RavenDB store variables of an instance of a class?

我读到 on this tutorial RavenDB 可用于存储 class 的实例(例如他们使用的 Menu 对象)。我尝试重现他们的示例,但在 C# 中使用了一个更小的示例:

using Raven.Client.Document;
using Raven.Client;

namespace Project3
{
    class MainClass
    {
        public static void Main()
        {
            IDocumentStore docStore = new DocumentStore()
            {
                Url = "http://localhost:8080",
                DefaultDatabase = "Northwind"
            };
            docStore.Initialize();
            var session = docStore.OpenSession();
            StringHolder strHolder = new StringHolder();
            session.Store(strHolder);
            session.SaveChanges();
        }
    }
    class StringHolder
    {
        string name = "kj";
    }
}

但是,当我 运行 这样做并检查数据库时,这是我看到的记录:

所以 StringHolder 参数 name 没有被存储。为什么会发生这种情况,在本教程中,使用 MenuAllergenics 的类似过程导致 class 变量存储在生成的文档中?

class StringHolder 的 属性 name 是私有的,因此不会被序列化。只有 public 个属性保存到数据库中。