Hi,
I want to upate entity object, but I got this error.
Steps:
- document = await _re.GetAsync(id.Value);
- document.FullPath = filePath;
- await _re.UpdateAsync(document); Now get an error: Attaching an entity of type 'eDocument.MultiTenancy.Tenant' failed because another entity of the same type already has the same primary key value. This can happen when using the 'Attach' method or setting the state of an entity to 'Unchanged' or 'Modified' if any entities in the graph have conflicting key values. This may be because some entities are new and have not yet received database-generated key values. In this case use the 'Add' method or the 'Added' entity state to track the graph and then set the state of non-new entities to 'Unchanged' or 'Modified' as appropriate.
My document class: public class Document : Entity<int>, IFullAudited, IMayHaveTenant
I continuously get this error after I update abp framework. But, got this error if I save document after page is loaded. The second document save is working.
Any help is appreciated
Marcell
5 Answer(s)
-
0
Hi,
Where do you run these lines ? In an application service ? Can you share your method definition including these lines ?
-
0
Hi,
Also, is it working if you don't call _re.UpdateAsync ?
-
0
<cite>ismcagdas: </cite> Hi,
Where do you run these lines ? In an application service ? Can you share your method definition including these lines ?
Hi,
I use update code in controller in Web layer.
thx Marcell
-
0
<cite>hikalkan: </cite> Hi,
Also, is it working if you don't call _re.UpdateAsync ?
Hi,
I'll try it.
thx Marcell
-
0
<cite>marcl: </cite>
<cite>hikalkan: </cite> Hi,
Also, is it working if you don't call _re.UpdateAsync ?
Hi,
I'll try it.
thx Marcell
Hi,
No, I tried it.
thx
Marcell