I know that I can use virtual keyword to tell the entity framework that the child table should be loaded LAZY way. as,
public class Person
{
public virtual string Name { get; set; }
public virtual int Age { get; set; }
public virtual History PastHistory { get; set; }
public virtual ICollection<Blog> Blogs { get;set; }
}
public class Blog
{
..... blah.. blah.... blah
}
public class History
{
.... blah blah blah
}
Now, my question,
As History is not a collection but 1:1 mapping for another entity, should I mark History as Virtual if I want to load History Lazy way ?
Is there any benefit for marking the simple properties (i.e. Name: string, Age : int) as virtual ? At this moment, I marked all my simple properties as virtual for no obvious reason. If anyone confirms me that marking simple properties as virtual has no effect at all in EF Code First, I will remove the marks to look my POCO clearer.
Thanks.