我在MVC项目中有类,我使用了Entity Framework 6.每个人都有一个Master(public class Person
{
[Key]
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Email { get; set; }
[ForeignKey("Person")]
public int Master_Id { get; set; }
public virtual Person Master { get; set; }
public virtual ICollection<Person> Persons { get; set; }
}
),它引用了同一个表(Person表中的主键)。我的方式不起作用......解决方案是什么?
from django.views.generic.dates import BaseDateListView
class YourClass(BaseDateListView):
def get_dated_queryset(self, **lookup):
return queryset with specific date range
答案 0 :(得分:0)
public class Person
{
[Key]
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Email { get; set; }
public int? MasterId { get; set; }
[ForeignKey("MasterId")]
public virtual Person Master { get; set; }
public virtual ICollection<Person> Persons { get; set; }
}