我正在学习 RavenDB 并熟悉事物的工作方式。我不明白的一件事是如何将 raven 创建的 id 保存到属性中。
public class User
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string ID { get; set; } //This will be null when I save object to DB I want it to be same as generated
}
[TestMethod]
public void TestSaving()
{
using (var session = documentStore.OpenSession())
{
var user = new User { FirstName = "John", LastName = "Doe" };
session.Store(user);
session.SaveChanges(); //I want that property to save that id that raven created: Users/65
}
}