My models look the following:
public class Job
{
public int Id { get; set; }
public virtual JobResult Result { get; set; }
}
public class JobResult
{
[Key, ForeignKey("Job")]
public int JobId { get; set; }
[Required]
public virtual Job Job { get; set; }
}
As you see the relationship is a required one-to-one. When I try to create and save a job:
Job job = new Job();
job.Result = new Result();
context.Jobs.add(job);
context.SaveChanges();
I get the following error:
Unable to determine a valid ordering for dependent operations. Dependencies may exist due to foreign key constraints, model requirements, or store-generated values.
I don't quite understand the error message. What does it mean and what could be causing this error?