看看这个示例代码:
public class Comment
{
private Comment()
{ }
public Comment(string text, DateTime creationDate, string authorEmail)
{
Text = text;
CreationDate = creationDate;
AuthorEmail = authorEmail;
}
public virtual string Text { get; private set; }
public virtual DateTime CreationDate { get; set; }
public virtual string AuthorEmail { get; private set; }
}
Run Code Online (Sandbox Code Playgroud)
我知道从构造函数调用虚拟成员函数被认为是不好的做法,但是在NHibernate中我需要虚拟属性来支持延迟加载.在这种情况下它被认为是好的吗?
| 归档时间: |
|
| 查看次数: |
3303 次 |
| 最近记录: |