More specifically in Raven DB, I want to create a generic method with a signature like;
public void Clear() {...
Then have Raven DB cl
I had this problem as well and this is the solution that worked for me. I'm only working in a test project, so this might be slow for a bigger db, but Ryan's answer didn't work for me.
public static void ClearDocuments(this IDocumentSession session)
{
var objects = session.Query().ToList();
while (objects.Any())
{
foreach (var obj in objects)
{
session.Delete(obj);
}
session.SaveChanges();
objects = session.Query().ToList();
}
}