How to group by on 2 child entities and get total of both this child entities?

前端 未结 3 1811
情歌与酒
情歌与酒 2020-11-27 23:32

I want to get total variants run for my Test Version 0 i.e Test Id=100

This is my table and records:

Test:

3条回答
  •  自闭症患者
    2020-11-28 00:27

    Update

    Ok Learning, here it is a solution..

    var tot_variants_for_test =
        (from v_name in 
           (from t_op in test 
            select new { v_name = t_op.TestOperation.Select(sv => sv.SubVariants.Variants.Name) }
           ).First().v_name 
         select v_name)
        .Union(
        (from v_name in 
          (from t_opdf in test 
           select new { v_name = t_opdf.TestOperationDifference.Select(sv => sv.SubVariants.Variants.Name) }
         ).First().v_name
         select v_name))
       .Count();
    

提交回复
热议问题