If you’re not using ServiceStack’s Audit History then you should be able to make the update directly with the DB, something like:
public DeleteConfigurationResponse Delete(DeleteConfiguration request)
{
using var db = AutoQuery!.GetDb(base.Request);
db.UpdateOnly<Configuration>(() => new Configuration {
DataEventId = (byte) DataEventType.Deleted,
DataEventOn = DateTime.UtcNow,
}, where: x => x.Id == request.Id)
//...
}
I’ve also added OnBefore/After events for Create/Update/Patch/Delete operations (Sync + Async), so you could achieve the same thing using the OnBeforeCreate
event hook, e.g:
Plugins.Add(new AutoQueryFeature {
AutoCrudMetadataFilters = { MyAuditFilter },
OnBeforeDelete = meta => {
if (meta.Dto is DeleteConfiguration dto) {
db.UpdateOnly(() => new Configuration {
DataEventId = (byte) DataEventType.Deleted,
DataEventOn = DateTime.UtcNow,
}, where: x => x.Id == dto.Id);
}
},
});