'Many to zero relationship with Entity Framework
I have difficulty understand how I can make a "connecting" table between TimeLogEntity and TimeLogPeriodEntity (see classes below).
public class TimeLogEntity
{
public int Id {get; set;}
public DateTime Date { get; set; }
...
public TimeLogPeriodEntity TimeLogPeriod { get; set; }
}
public class TimeLogPeriodEntity
{
public int Id {get; set;}
public string Name {get; set; }
public DateTime From {get; set; }
public DateTime To {get; set; }
...
public ICollection<TimeLogEntity> TimeLogs{ get; set; }
}
I want EF to generate 3 tables: TimeLogs, TimeLogPeriods and TimeLogPeriodCrossTimeLogs,
I want a TimeLogPeriod to have multiple TimeLogs. But a TimeLog don't have to have a TimeLogPeriod.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
