开发者

Castle ActiveRecord - Issue With Setter

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)]
开发者_Go百科        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

Castle ActiveRecord - Issue With Setter

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?


You're setting AccountId in place of accountId which creates an infinite loop. Use the fix below:

set { accountId = value; }

You're also doing the same mistake with CompanyName also so fix that too.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜