I’ve noticed that, by default, Entity Framework Code First neglects to instantiate ICollection<T> properties unless there is at least one item in the collection. I would much prefer that the collection were guaranteed to always be an empty HashSet (i.e., a HashSet with zero items) rather than null if no items exist.
Is there any convention or setting for EF Code First that would enable this?
in the constructor of the entity just set instantiate the collection:
The suppression message is there for FXcop.