应用程序类具有Applicant对象:
public class Application
{
public virtual ICollection<Applicant.Applicant> Applicants { get; set; }
...
}
申请人类将Employee对象作为集合:
public class Applicant
{
public virtual ICollection<Employment> Employments { get; set; }
}
如何以这种方法获得就业人数:
public void InsertApplication(Application application)
答案 0 :(得分:4)
您可以使用application.SelectMany(a=>a.Applicants.SelectMany(x=>x.Employments)).Count()
答案 1 :(得分:0)
使用Count
property可以检索Default Web Site
Applicant
次{...}
Employment
applicant.Employments.Count
Application
个Employment
计数是Applicant
Employment
个application.Applicants.Sum(applicant => applicant.Employments.Count);
点数的sum ...
heroku run rake db:schema:dump
heroku restart