0
我有以下模型和方法:PetaPoco返回不正確ID
[PetaPoco.TableName("TestStep")]
[PetaPoco.PrimaryKey("ID")]
public class TestStep
{
public int ID { get; set; }
public int ParentID { get; set; }
public string Name { get; set; }
public string Details { get; set; }
}
public IEnumerable<TestStep> GetById(int ID)
{
var db = new PetaPoco.Database("TestProcedureDB");
return db.Query<TestStep>(@"SELECT * FROM TESTSTEP TS
INNER JOIN TESTSTEPLINK L ON L.STEPID = TS.ID
WHERE L.TESTID = @0", ID);
}
當POCO填充,ID屬性值是,在TESTSTEPLINK表中的ID列。如果我更改查詢返回SELECT TS.*
然後一切正常。這是一個錯誤還是我錯過了什麼?