Reputation: 901
Say I'm storing a new document without specifying an id so it uses the raven automatic one, how would I then retrieve that id for immediate use?
League league = new League(){Name = "League1"};
RaventSession.Store(league);
Division division = new Division(){ Name = "Division1",
LeagueId = //need league id for this property
Upvotes: 0
Views: 73
Reputation: 622
When you store an entity, the id is assigned to the entity (if you don't set it) then check league.Id after RaventSession.Store(league);
note that you can also use RaventSession.Advanced.GetDocumentId(league);
to retrieve the stringId of the entity
Upvotes: 2