public class TempClass
{
public int ID { get; set; }
public int CountEntries { get; set; }
}
string sql = "select ID, count(*) as CountEntries from table1;select ID, count(*) as CountEntries from table2";
var result = _dbContext.Database.SqlQuery<TempClass>(sql).ToList<TempClass>(); ???
执行几个命令,可以使用EF Code First吗?或者你必须一次得到一个(上面的结果是2个SqlQueries。
答案 0 :(得分:0)
我认为你可以使用这个:
var query = (from s in context.table1.Take(1)
select new
{
subSetA = context.tablw1.ToList(),
subSetB = context.tablw2.ToList(),
})