说我有两个表:Table_1和Table_2,
我想将结果查询到Model
public class Model
{
public Table_1 table1 { get; set; }
public Table_2 table2 { get; set; }
}
void Query(Database database)
{
string sql = @"SELECT table1.*, table2.* FROM Table_1 table1 JOIN Table_2 table2 on table1.ID=table2.ParentID";
var result = database.SqlQuery<Model>(sql).ToArray();
}
,但是这两个属性的结果始终为null,如何使它们填充?还是EF不支持此功能?