❔ Entity Framework
im trying to make spotify like application but anytime i try to get the user who created the playlist it turns up null.
13 Replies
$code
To post C# code type the following:
```cs
// code here
```
Get an example by typing
$codegif
in chat
If your code is too long, post it to: https://paste.mod.gg/Please format code properly
how can i format it?
Read the message above
Include should work. Presume you don't have data in the db or something like that
i get this back
creator should be filled with a user
All the ids are 0, so looks like you didn't add the user data correctly
There's also no creatorId in your returned json ...
Why do you assign
null!
to everything?
Anyway you probably forgot to specify how to map your creator?
That or the id is not saved at all. Did you check your database?It's one way to avoid Compiler warnings
This is a null forgiving operator on null. How this is valid?
Is the whole point to throw an error when the value is not set?
The point is just to shut the compiler up. The value will be set by EF, so we don't care about it not being set in the constructor
exactly that
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.