假设我有这 2 个表/域
[TableName("TableA")]
[PrimaryKey("TableAId")]
public class TableA
{
public int TableAId { get; set; }
public string City { get; set; }
public TableB TableB { get; set; }
public TableA()
{
TableB = new TableB();
}
}
[TableName("TableB")]
[PrimaryKey("TableBId")]
public class TableB
{
public int TableBId { get; set; }
public string Name { get; set; }
}
var sql = @" Select TableA.*, TableB.*
FROM TableA INNER JOIN
TableB ON TableA.TableBId = TableB.TableBID";
// peta poco
var result = db.Query<TableA, TableB>(sql);
当我这样做时,TableA.TableB
被填充并且TableA
id 被填充但City
为空。我必须指定要绑定的每一列。是否可以只使用星号而不是指定每一列?