Most (if not all) my Entity Framework POCOs have virtual functions. I need these functions to be virtual so that the entities can be lazy-loaded.
If I initialize Accommodations
in constructor then I will be calling a virtual function in constructor, which is bad practice.
But how can I initialize Accommodations
if not in the constructor?
public class Venue
{
public Venue()
{
Accommodations = new HashSet<Accommodation>();
}
public virtual ICollection<Accommodation> Accommodations { get; set; }
}