private BatchResult Delete(DeleteCommandData command)
 {
     if (database.ContainsKey(new Guid(command.Key))) {
         database.Remove(new Guid(command.Key));
     }
     return new BatchResult() {
         Key = command.Key,
         Etag = null,
         Method = command.Method,
         Metadata = command.Metadata,
     };
 }
Example #2
0
        Action CreateCleanUpProcedure(string id)
        {
            if (string.IsNullOrEmpty(id)) return () => { };

            return () =>
            {
                using (var session = _documentStore.OpenSession())
                {
                    var deleteCommands = new DeleteCommandData { Key = id };
                    session.Advanced.Defer(deleteCommands);
                    session.SaveChanges();
                }
            };
        }
 private BatchResult Delete(DeleteCommandData deleteCommand, StringBuilder batchCommandBuilder, Action<string, object> addParamWithValue, int cmdIndex)
 {
     batchCommandBuilder.AppendLine("DELETE FROM " + settings.DocumentTableName + " WHERE [Id] = @id" + cmdIndex + ";");
     addParamWithValue("@id" + cmdIndex, new Guid(deleteCommand.Key));
     return new BatchResult() {
         Key = deleteCommand.Key,
         Etag = null,
         Method = deleteCommand.Method,
         Metadata = deleteCommand.Metadata,
     };
 }