I'm having trouble saving a model with a small complex relationship to the database.
UML classes: 
Class Definition:
public abstract class EntityBase { public virtual Guid Id { get; set; } } public class LoanRequest : EntityBase { [Key,DatabaseGenerated(DatabaseGeneratedOption.Identity)] public Guid Id { get; set; } public virtual Applicant Applicant1 { get; set; } public virtual Applicant Applicant2 { get; set; } } public class Applicant { [Key,DatabaseGenerated(DatabaseGeneratedOption.Identity)] public Guid Id { get; set; } public Guid LoanRequestId { get; set; } [ForeignKey("LoanRequestId")] public virtual LoanRequest LoanRequest { get; set; } public virtual ICollection<MonthlyIncome> Incomes { get; set; } } public class MonthlyIncome { [Key,DatabaseGenerated(DatabaseGeneratedOption.Identity)] public Guid Id { get; set; } public Guid ApplicantId { get; set; } [ForeignKey("ApplicantId")] public virtual Applicant Applicant { get; set; } }
I can start the migration and look at the database, the tables and columns created by the structure seem fine to me. But while saving the exception happens. The exception is:
It is not possible to determine the actual ordering for dependent operations. Dependencies may exist due to foreign key restrictions, model requirements, or store values.
I searched for a solution on the Internet and I donβt see where my problem is. Any suggestions? Thanks!
source share