I have a collection mapped in my model:
public class Project
{
// ...
public virtual ICollection<ProjectSupplier> ProjectSuppliers {get; set;}
}
And I want to retrieve original value of ProjectSuppliers
collection (I know for sure that it has been loaded). I tried:
var originalProjectSuppliers = _context.Entry(project)
.OriginalValues
.GetValue<ICollection<ProjectSupplier>>("ProjectSuppliers");
But it gives me error:
System.ArgumentException : The 'ProjectSuppliers' property does not exist or is not mapped for the type 'Project'
I also tried getting DbCollectionEntry
like that:
_context.Entry(project).Collection(p => p.ProjectSuppliers)
But it doesn't contain OriginalValues
, only current ones.