Setter removed from Entity for Child Entities in EF 7
See original GitHub issueThis piggybacks on #1582 and #1587, of which both are marked closed. @ErikEJ asked in both threads why would someone want to reassign the navigation property. In my case we have several places where we sort the collection after it has been returned from the database.
class.Students = class.Students.OrderBy(s => s.Property).ToList();
Obviously a trivial example. The collection of class.Students could have been originally retrieved from the database with or without a sort. It could have been added to after the original query, etc. However we need the final collection sorted in place. Of course there are work arounds like clearing the original collection and adding to it a sorted one, using .Sort(), or customizing the T4 templates. However I’m trying to understand whether our usage goes against best practices? What is the proper/recommended way of solving this? There must be a reason why child properties are now read only. This was not clear from both closed items referenced above.
Issue Analytics
- State:
- Created 10 months ago
- Comments:14 (10 by maintainers)
Top GitHub Comments
@btcalit Good question! The reverse engineering “engine” is packed as a .NET command line tool, and that tool now uses EF Core 7.0.5.
I implemented a fix for this in the latest daily build, would be grateful if you could try it out.
If you like my free tools, I would be very grateful for a rating or review on Visual Studio Marketplace or even a one-time or monthly sponsorship