开发者

Subsonic Simple Repository - Persist Private Property

I am making use of Subsonic开发者_运维技巧 SimpleRepository

i have a class:

public class X{public string abc {get; set;}private string def {get; set;}}

property "def" is only set within that class and i don't want the property to be visible externally, but for some reason when i save the object using Repo.Save(x) the private property is not persisted to the DB

Any help?


Set up a two data models, one that represents X in the front-end (public, visible) and one that represents X in the back-end (private, hidden):

namespace App.BackEnd // classes here are used for database storage
{
    public class X
    {
        public string abc { get; set; }
        public string def { get; set; }

        public FrontEnd.X ToFrontEnd()
        {
            return new FrontEnd.X
            {
                abc = abc
            };
        }
    }
}

namespace App.FrontEnd // classes here are used for public interfaces
{
    public class X
    {
        public string abc { get; set; }
    }
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜