Ravendb中的DocumentID问题
-
09-10-2019 - |
题
我已经从这里下载了MVC的示例应用程序 http://ravenmvc.codeplex.com/releases/view/45994
它的工作正常。但是我有一个问题。在示例应用程序中,documentID看起来像“ categories-2”,但是在我调用商店方法后的应用程序中:
using (var session = DocumentStore.OpenSession())
{
session.Store(item);
session.SaveChanges();
return item;
}
我有诸如“项目/3073”之类的DocumentID。我想像示例应用程序一样,将DocumentID添加到格式中。我该怎么做?我应该更改一些选择吗?
解决方案
初始化文档存储时,您需要设置文档版本:
var ds = new DocumentStore();
ds.ConnectionStringName = connectionStringName;
ds.Initialize();
ds.Conventions.IdentityPartsSeparator = "-";
不隶属于 StackOverflow