Answer the question
In order to leave comments, you need to log in
How to implement Entity Framework polymorphic relationships?
Hello!
Interested in the question of how to implement polymorphism, in the following configuration?
We have the following models:
public class Staff
{
[HiddenInput(DisplayValue = false)]
public int Id { get; set; }
public string Name {get;set;}
public virtual ICollection<StaffReports_> StaffReports { get; set; }
}
public class StaffReports_
{
public int ReportId { get; set; }
public Report Report { get; set; }
public int? StaffId { get; set; }
public Staff Staff { get; set; }
}
public class Report
{
public int Id { get; set; }
public DateTime DateNow { get; set; }
public string Autor { get; set; }
public ICollection<StaffReport_> Interns { get; set; }
}
public class StaffReports1_
{
public int ReportId { get; set; }
public Report Report { get; set; }
public int? StaffId { get; set; }
public Staff Staff { get; set; }
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question