在PetaPoco中,如何装饰具有多列主键的表
在 PetaPoco 网站上给出的示例中,这是如何装饰一个类:
[PetaPoco.TableName("articles")]
[PetaPoco.PrimaryKey("article_id")]
public class article
{
public long article_id { get; set; }
public string title { get; set; }
public DateTime date_created { get; set; }
public bool draft { get; set; }
public string content { get; set; }
}
但是假设表 items 被建模为有 2 列:article_id 和 title 作为其主键(而不是只有article_id),那么 PetaPoco 中的装饰如何看起来像。
In the example given on PetaPoco's web site, this is how to decorate a class:
[PetaPoco.TableName("articles")]
[PetaPoco.PrimaryKey("article_id")]
public class article
{
public long article_id { get; set; }
public string title { get; set; }
public DateTime date_created { get; set; }
public bool draft { get; set; }
public string content { get; set; }
}
But assume that the table articles was modeled to have 2 columns: article_id and title as its primary key (instead of just article_id), then how the decoration in PetaPoco would look like.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
目前,这仅适用于我的分支,但您可以这样做。
我的分行可以在这里找到。
https://github.com/schotime/PetaPoco
This currently only works in my branch, but you can do this.
My branch can be found here.
https://github.com/schotime/PetaPoco