After registering an id convention, the GenerateDocumentKey
method will use that convention instead of the default hilo generation scheme.
It needs some parameters, which are easiest to get at if you first cast the IDocumentSession
to a real DocumentSession
.
var s = ((DocumentSession) session);var key = s.Conventions.GenerateDocumentKey(s.DatabaseName, s.DatabaseCommands, yourEntity);