Thank you very much Kijana!
Here is the code we use to delete the database.
In essence we are assuming the request to delete is synchronous and are waiting for it to complete and waiting a second after that to continue.
We also use the hard-delete option because that is what the silverlight client issues to delete the database with all data.
This seems to not work all the time though.
using(var session = _documentStore.OpenSession()) {
var databaseCommands = _documentStore.DatabaseCommands;
var relativeUrl = "/admin/databases/" + cobrandSubdomain;
if (hardDelete) relativeUrl += "?hard-delete=true";
do {
try {
var serverClient = databaseCommands.ForSystemDatabase() as ServerClient;
Thread.Sleep(1000);
var httpJsonRequest = serverClient.CreateRequest("DELETE", relativeUrl);
Thread.Sleep(1000);
httpJsonRequest.ExecuteRequest();
Thread.Sleep(1000);
processComplete = true;
} catch (Exception ex) {
if (!(ex is IOException)) throw ex;
else Thread.Sleep(1000);
}
} while (processComplete != true);
}
return new OperationStatus {
Status = Models.Status.Success,
Message = "Successful Deletion of Database from Raven"
};
We will also look into deleting the physical files - but if we could delete it by just issuing a request to the server that would be great because we could run our utility remotely (as we currently do with our build/deploy server setup)
So maybe on our part we could try a small test of quickly issuing a create / delete loop and see if we get this to happen pretty consistently on different servers and then post the code?
Thank you again!
Arun