I am generating the error:
System.InvalidOperationException Unable to determine the relationship represented by navigation property 'Quote.QuoteRequest' of type 'ICollection<QuoteRequest>'. Either manually configure the relationship, or ignore this property from the model.
I am certain the reason is I need to have a single entity with two different relationships.
The models relationships are:
Quote
public ICollection<QuoteRequest> QuoteRequest { get; set; } public Staff Staff { get; set; }
public ICollection<QuoteProcedure> QuoteProcedure { get; set; }
public ICollection<QuoteToQAss>QuoteToQAss{get;set;}
public ICollection<QuoteToQEx> QuoteToQEx { get; set; }
public ICollection<QuoteToKitset> QuoteToKitset { get; set; }
public ICollection<QuoteToProduct> QuoteToProduct { get; set; }
public ICollection<QuoteTasks> QuoteTasks { get; set; }
public ICollection<QuoteDetails> QuoteDetails { get; set; }
[ForeignKey("myQuoteRequest")]
public QuoteRequest QuoteRequests { get; set; }
QuoteRequests:
public Boolean Quoted { get; set; } //public int? QuoteID { get; set; } public Client Client { get; set; } public Site Site { get; set; } public WaterBody WaterBody { get; set; } public Quote Quote { get; set; } [ForeignKey("aQuoteRequest")] [InverseProperty("myQuoteRequest")] public ICollection<Quote> Quotes { get; set; }
I thought specifying the foreign key and giving it a different name would work. But it seems EF doesn't like this approach.
This is not an unusual situation, although not usual either, in a normalised data table, so I would assume it can be done. What is the correct approach?