❔ EF Core question
Currently I define my models like this, should these collections be defined as null! or should I do new List<Client>() in the class?
currently I add clients when I create an user like this
5 Replies
null!
will be fine if you always get these from EF, but it will be iffy if you ever do var x = new User()
how do I create a new user without doing new User? rn i just do new User() then user.Clients = new List<Client>();
can't find convention in msdn
You could make the constructor private/protected, and make a static creation method
ie
ty
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.