Optimistic Concurrency in AutoQuery CRUD require a ulong RowVersion
property on the Request DTO so it’s better to use a ServiceFilter
, e.g:
Plugins.Add(new AutoQueryFeature {
MaxLimit = 1000,
GenerateCrudServices = new GenerateCrudServices {
// Comment below to disable auto-generation of missing AutoQuery Services
AutoRegister = true,
ServiceFilter = (op,req) => {
if (op.Request.Properties.All(x => x.Name != "RowVersion"))
{
op.Request.Properties.Add(new MetadataPropertyType {
Name = "RowVersion",
Type = "UInt64",
TypeNamespace = "System",
DataMember = new MetadataDataMember {
Order = op.Request.Properties.Max(x => x.DataMember?.Order ?? 0) + 1
}
});
}
}
}
});
But you’ll want to modify it so it only adds the property to the Request DTOs where you want it enabled.