You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for example if your entity has property same as public ICollection<DiseaseAttachment> Attachments { get; set; }
in update method in your controller you must load it by using LoadCollectionAsync
in my usecase : var model = await Repository.GetByIdAsync(cancellationToken, dto.Id); await Repository.LoadCollectionAsync(model, x => x.Attachments, cancellationToken);
but problem is here that exception occurred
`
model = dto.ToEntity(Mapper, model);
System.InvalidOperationException : The instance of entity type 'DiseaseAttachment
' cannot be tracked because another instance with the same key value for {'Id'} is already being tracked. When attac
hing existing entities, ensure that only one entity instance with a given key value is attached. Consider using 'DbC
ontextOptionsBuilder.EnableSensitiveDataLogging' to see the conflicting key values
The text was updated successfully, but these errors were encountered:
for example if your entity has property same as
public ICollection<DiseaseAttachment> Attachments { get; set; }
in update method in your controller you must load it by using LoadCollectionAsync
in my usecase :
var model = await Repository.GetByIdAsync(cancellationToken, dto.Id); await Repository.LoadCollectionAsync(model, x => x.Attachments, cancellationToken);
but problem is here that exception occurred
`
model = dto.ToEntity(Mapper, model);
`
exception is this :
System.InvalidOperationException : The instance of entity type 'DiseaseAttachment
' cannot be tracked because another instance with the same key value for {'Id'} is already being tracked. When attac
hing existing entities, ensure that only one entity instance with a given key value is attached. Consider using 'DbC
ontextOptionsBuilder.EnableSensitiveDataLogging' to see the conflicting key values
The text was updated successfully, but these errors were encountered: