My situation is as follows: The Periodic Task entity can have many Tasks, but a Task can have none or only a Periodic Task associated with it. That is, I need the foreign key of Task Periodic on Task to be null. However, I am not able to do this configuration through the Entity Framework, even with the statement:
public int? PeriodicTaskID
What are the possible solutions?
Thank you very much.
public class Task
{
public int TaskID { get; set; }
public int? PeriodicTaskID { get; set; }
public virtual PeriodicTask PeriodicTask { get; set; }
}
public class PeriodicTask
{
public int PeriodicTaskID { get; set; }
public virtual ICollection<Task> Tasks { get; set; }
}