How to use IEnumerable
as a navigation property, I don't want to expose a List for the client developer and give him extra distracted,undesirable functionalities like Clear(),CopyTo()
.
So I did the following :
private readonly List<WorkTime> _assignedWorkTimes;
public virtual IEnumerable<WorkTime> AssignedWorkTimes { get => _assignedWorkTimes; }
But When I use EF Power tool
to render the model I see no relationship between the two entities.
Note: I make a unidirectional relationship (based on DDD
recommendations) with only a Foreign key in Worktime
to facilitate the data operations.