Hi,
I have a scenario where I am using a regular document session where I want to delete a document that is not in the session. So I need to do this:
var session = store.OpenSession();
//do stuff
session.Advanced.DatabaseCommands.Delete(someOtherDocumentId);
session.SaveChanges(); // commit other changes
What would be nice is a way to defer the delete command so it will be called at SaveChanges() and get one less round trip to the DB:
var session = store.OpenSession();
//do stuff
session.Advanced.DatabaseCommands.DeferCommand(new DeleteCommandData() { ... });
session.SaveChanges(); // now, the actual delete command will be sent in the same round trip as everything else.
What do you think?
/Johannes