Castle ActiveRecord - Setter 问题
好的,所以我开始了一个新项目并决定使用 ORM 工具(因为我厌倦了手动编写) 所以我开始使用 Castle AR,
所以在我的领域目标中有以下内容
[ActiveRecord]
public class Account : ActiveRecordBase<Account>
{
private string companyName;
private Guid accountId;
[PrimaryKey(Access = PropertyAccess.FieldCamelcase)]
public Guid AccountId
{
get { return accountId; }
}
[Property(Access = PropertyAccess.FieldCamelcase)]
public string CompanyName
{
get { return companyName; }
// set { companyName= value; }
}
}
,这可以工作并提取我的记录。 但如果我取消注释该集,我会得到以下内容
显然我很快就会需要这套套件 (通常我也会在 CompanyName "Access=PropertyAccess.FieldCamelCase" 上删除它)
有什么想法我做错了吗?
Ok, so im starting a new project and decided to use a ORM tool (as im so bored with writing it manually)
So im starting new with Castle AR,
So in my domain object ive the following
[ActiveRecord]
public class Account : ActiveRecordBase<Account>
{
private string companyName;
private Guid accountId;
[PrimaryKey(Access = PropertyAccess.FieldCamelcase)]
public Guid AccountId
{
get { return accountId; }
}
[Property(Access = PropertyAccess.FieldCamelcase)]
public string CompanyName
{
get { return companyName; }
// set { companyName= value; }
}
}
And this works and pulls out my records.
But if I uncomment the set I get the following
Obviosuly im going to need the set soon
(normally I would also remove this on CompanyName "Access=PropertyAccess.FieldCamelCase")
Any ideas what im doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您设置
AccountId
代替accountId
,这会创建无限循环。使用下面的修复:您也对
CompanyName
犯了同样的错误,所以也修复它。You're setting
AccountId
in place ofaccountId
which creates an infinite loop. Use the fix below:You're also doing the same mistake with
CompanyName
also so fix that too.