我注意到,当我向RavenDB添加文档并查看"Raven-Entity-Name"元数据时,它使其成为复数.例如,如果我的模型名称是将Product其更改为Products.为什么这种行为?
如果我创建了一个索引,我不得不使用 docs.Products
Mat*_*ren 12
RavenDB的理念是对配置进行约定,因此默认情况下这样做.
但是如果你愿意,你可以覆盖它,你可以这样做:
_documentStore = new DocumentStore { Url = "http://localhost:8080/" };
_documentStore.Conventions.FindTypeTagName = t =>
{
if (t.Name == "MyClass")
return "MyClassBlahBlah";
else
return Raven.Client.Util.Inflector.Pluralize(t.Name);
};
_documentStore.Initialize();
Run Code Online (Sandbox Code Playgroud)
有关详细信息,请参阅RavenDB讨论组中的此主题