似乎有很多方法可以实现这一点,但我试图弄清楚.net Core 2 / EF core 2.0 的最佳实践是什么。
我有诸如
public class Company {
public Guid CompanyID {get; set;}
public ICollection<Order> Orders {get; set;}
...
public ICollection<UserLocation> UserLocations { get; set; }
}
public class Order {
public Guid CompanyID { get; set; }
public Company Company { get; set; }
public DateTime OrderDate {get; set;}
}
public class UserLocation {
public Guid CompanyID { get; set; }
public Company Company { get; set; }
public String UserId { get; set; }
public ApplicationUser ApplicationUser { get; set; }
}
对于我的公司索引页面,我只希望显示用户有权访问的公司。可以为此使用全局过滤器还是在这种情况下不起作用?
谢谢