使用 Petapoco 的 Column 和 ResultColumn 之间的区别?
Difference Between Column and ResultColumn Using Petapoco?
我 Class 喜欢
public class Myclass
{
[Column]
public string no{ get; set; }
[Column]
public string Name{ get; set; }
[Column]
public string Address{ get; set; }
[Column]
public DateTime DOB{ get; set; }
}
我的select查询是
List<Myclass> list=DAL.db.Fetch("select b.ref_no no,a.name,a.Address,a.DOB from tbla a join tblb b on b.id=a.ref_id");
有时我会得到错误的结果,我得到了相同的结果record.I猜想我的class装饰变成了这样,
public class Myclass
{
[ResultColumn]
public string no{ get; set; }
[ResultColumn]
public string Name{ get; set; }
[ResultColumn]
public string Address{ get; set; }
[ResultColumn]
public DateTime DOB{ get; set; }
}
栏目
Is an attribute which can decorate a Poco property to mark the
property as a column. It may also optionally supply the DB column
name.
结果列
Is an attribute which can decorate a Poco property as a result only
column. A result only column is a column that is only populated in
queries and is not used for updates or inserts operations.
看这里https://github.com/CollaboratingPlatypus/PetaPoco/wiki/Mapping-Pocos
我 Class 喜欢
public class Myclass
{
[Column]
public string no{ get; set; }
[Column]
public string Name{ get; set; }
[Column]
public string Address{ get; set; }
[Column]
public DateTime DOB{ get; set; }
}
我的select查询是
List<Myclass> list=DAL.db.Fetch("select b.ref_no no,a.name,a.Address,a.DOB from tbla a join tblb b on b.id=a.ref_id");
有时我会得到错误的结果,我得到了相同的结果record.I猜想我的class装饰变成了这样,
public class Myclass
{
[ResultColumn]
public string no{ get; set; }
[ResultColumn]
public string Name{ get; set; }
[ResultColumn]
public string Address{ get; set; }
[ResultColumn]
public DateTime DOB{ get; set; }
}
栏目
Is an attribute which can decorate a Poco property to mark the property as a column. It may also optionally supply the DB column name.
结果列
Is an attribute which can decorate a Poco property as a result only column. A result only column is a column that is only populated in queries and is not used for updates or inserts operations.
看这里https://github.com/CollaboratingPlatypus/PetaPoco/wiki/Mapping-Pocos