Discussions
REST API: System.Data.ObjectNotFoundException: Item to be saved not found in identity map
over 1 year ago by Max(edited)
Hi - this is iMIS 2017 (20.2.66.1330).
I have a business object called TestFreightRate composed of all the columns of the Freight_Rate table except for timestamp. If I try to update a record in the REST API, I'm getting a 500 Internal Server Error response.
I'm doing a PUT to this API path:
/api/TestFreightRate/~UPS-Ground|1|002
See attached screenshots of the business object, API GET request, API PUT request, and the error message from the event viewer on the web server. Here's the stack trace:
System.Data.ObjectNotFoundException: Item to be saved not found in identity map.
at Asi.Soa.Core.Domain.PersistenceStrategyBase.RetrieveIdentityItem(IdentityData identityData)
at Asi.Soa.Core.Persistence.BusinessPersistenceStrategyBase.SaveChanged(Object entityInstance)
at Asi.Soa.Core.Domain.Repository.PersistChanged(Object entityInstance)
at Asi.Soa.Core.Domain.UnitOfWork.Persist()
at Asi.Soa.Core.Domain.UnitOfWork.Commit()
at Asi.Services.Core.EntityServiceToCommonServiceAdapter1.Update(TDataContract dataContract)
at Asi.Services.Core.EntityServiceToCommonServiceAdapter1.Update(Object dataContract)
at Castle.Proxies.Invocations.ICommonService_Update.InvokeMethodOnTarget()
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Asi.Shared.Aspects.CacheAspect.Intercept(IInvocation invocation) in C:\\Builds\\208\\ScrumV3\\sp137_Main10\\Sources\\MainFoundation\\imis.net\\Packages\\Platform\\Asi.Shared\\Aspects\\CacheAspect.cs:line 62
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Asi.Services.Core.Interceptors.CommonSecurityAspect.Intercept(IInvocation invocation)
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Asi.Services.Core.Interceptors.ServiceTaskTriggerInterceptor.Intercept(IInvocation invocation)
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Asi.Shared.Aspects.PerformanceAspect.Intercept(IInvocation invocation) in C:\\Builds\\208\\ScrumV3\\sp137_Main10\\Sources\\MainFoundation\\imis.net\\Packages\\Platform\\Asi.Shared\\Aspects\\PerformanceAspect.cs:line 55
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Castle.Proxies.ICommonService\\1Proxy_2.Update(Object dataContract)
at Asi.Scheduler.Controllers.CommonServiceController.Put(String entityName, String entityId, Object entity)
I realize it's possible to update the record using the api/Freight_Rate endpoint, but due to an idiosyncrasy of our iDMS product, it'd be better if we could update a business object wrapping the Freight_Rate table.
Thanks