[英]Subsonic Simple Repository - Persist Private Property
I am making use of Subsonic SimpleRepository 我正在使用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 属性“ def”仅在该类中设置,并且我不希望该属性在外部可见,但是由于某些原因,当我使用Repo.Save(x)保存对象时,私有属性无法持久保存到数据库中
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): 设置两个数据模型,一个数据模型在前端表示X(公共,可见),另一个数据模型在后端表示X(私有,隐藏):
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; }
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.