I'm trying to support NHibernate proxying of my entities by marking the entities' properties as virtual:
public class Video : IAbstractDomainEntity<string>
{
public virtual string Id { get; set; }
public virtual string Title { get; set; }
public virtual int Duration { get; set; }
public virtual string Author { get; set; }
public virtual bool HighDefinition { get; set; }
public Video()
{
Id = string.Empty;
Title = string.Empty;
Author = string.Empty;
}
}
ReSharper states that this is bad practice due to the issue described here: Virtual member call in a constructor
I understand the problem and I also understand that I cannot mark my class as sealed because then NHibernate would not be able to generate a proxy from the entity.
Do I just live with the waning and make sure not to do anything weird with my setters?