djmurp
❔ Design Question
I don't think that would work because of circular references (Application references library, library references application), but you're right to be iffy about that anyway.
It would be better design to have the library offer the state via a method, and then the project which contains the Application class (or even the Application class itself) can decide its own fate by calling the method which returns the state and setting it itself.
This way the library isn't tied to Application and is now reusable in other places, and also you don't have a library changing state without you telling it when to do it
4 replies
✅ Collection appears to be null, even though it's not null on DB
it's empty because you are going via userManager, something provided to you via Identity.
It doesn't automatically know that you want all related data so it gives you the basics (column values). Anything more would result in a lot of SQL JOINs
85 replies
✅ Collection appears to be null, even though it's not null on DB
another approach would be entity framework lazy loading (in that case accessing .People will trigger additional SQL) but i'd avoid if possible - it's convenient but much less efficient!
85 replies
✅ Collection appears to be null, even though it's not null on DB
check this https://stackoverflow.com/questions/39837355/eager-loading-using-usermanager-with-ef-core, the answer for you actually in the question itself
85 replies