0
說我有這2個表/域PetaPoco/NPoco的多個查詢?
[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
爲空。我必須指定每個列進行綁定。有沒有使用明星而不是指定每一列?