Is it OK to call virtual properties from the constructor of a NHibernate entity?

前端 未结 6 599
有刺的猬
有刺的猬 2020-12-11 01:02

take a look at this example code:

public class Comment
{
    private Comment()
    { }

    public Comment(string text, DateTime creationDate, string authorE         


        
6条回答
  •  不思量自难忘°
    2020-12-11 01:26

    I think, you should not call it in the constructor. You can provide a method Initialize() which you can call after constructing the object.

    In Initialize() you can call the required virtual methods

提交回复
热议问题