ABP VNEXT使用PUT方法时报”对象已被修改,乐观并发失败“解决方案
调用ABP接口使用PUT方法时,出现以下错误,是因为提供的数据不全造成的。
提交数据:
{"Name":"11-31","IsDefault":false,"IsStatic":false,"IsPublic":false,"Id":"39faeb0a-e435-8b66-9ed8-249412ab39d9","ExtraProperties":{}}
错误提示:
{ "Error": { "Code": "Volo.Abp.Identity:ConcurrencyFailure", "Message": "对象已被修改,乐观并发失败.", "Details": null, "Data": {}, "ValidationErrors": null } }
解决方案:
提交数据时,增加上字段:ConcurrencyStamp,正确提交数据格式如下:
{"Name":"11-31","IsDefault":false,"IsStatic":false,"IsPublic":false,"ConcurrencyStamp":"7a476ac06b5e4db8aa698911068c29e0","Id":"39faeb0a-e435-8b66-9ed8-249412ab39d9","ExtraProperties":{}}