Does the virtual keyword has an effect when used on the properties in EF Code First?. Can someone describe all of its ramifications in different situations?

For instance, I know it can control lazy loading — if you use the virtual keyword on an ICollection/one-to-many relationship property, it will be lazy-loaded by default, whereas if you leave the virtual keyword out, it will be eager-loaded.

What other effects can virtual keyword have in EF with POCO entities?. Should I make it default to use virtual on all my properties, or default to not using it?

2 Answers
2

Leave a Reply

Your email address will not be published. Required fields are marked *