I have two tables A and B. Their relation is 1:N.
I want to update one field in ALL the children tables, but I’m don’t know what LINQ expression to use to do that — shouldn’t be too difficult.
I was thinking something like:
parentEntity.childrens.All(..lambda expr..).field = value;
But obviously it’s not working.
I know the other option is a foreach(..), but I’d prefer L2E if possible.
You can’t set a property on all items of a collection without somehow looping through that collection, either with
foreach,for,List<T>.ForEach, or similar.If you want to keep it in one line, you could do something like: