0
pointlevel created
Hi!
Need help with updating an entity thats included as an ICollection. I believe this is a simple task, but my brain is refusing to collaborate with me.
var stuff = _myRepository.GetAll().Include(x => x.MyList).Where(c => c.Condition == true)
How do i update the included "MyList" above. I also need to include some conditions before update (if/else etc..). Also i want to update the "main"-entitie at the end.
`
foreach (Item item in stuff.MyList)
{
if (item == something)
{
// Update the entity.
}
}
Big thanks in advance.
Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)
1 Answer(s)
-
0
According to your above, MyList has been tracked by EF. All you can update it. (
foreachno problem)Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)