I am working with ASP.NET MVC and Entity Framework (code first).
I have all the entity tables that are created by default, and I want to create a Review
table
public Guid Id { get; set; }
public ApplicationUser User { get; set; }
[MaxLength(125)]
[ForeignKey("User"),Column(Order = 0)]
public string ReviewerId { get; set; }
public DateTime Date{ get; set; }
[Required]
[MaxLength(125)]
public string Title{ get; set; }
public string Comment{ get; set; }
[ForeignKey("User"), Column(Order = 1)]
[MaxLength(125)]
public string ReviewedId { get; set; } // who we are reviewing
However when I try to add this table using add-migration, I get this error:
The number of properties in the dependent and principal roles in a relationship constraint must be identical.
How do I solve this issue? My idea is , I would like to be able to search reviews either by ReviewedId or ReviewerId.