0

Need a little help to understand the role of virtual ICollection in model of Entity Framework

public virtual ICollection<Staff> Staffs { get; set; }
Billu
  • 2,733
  • 26
  • 47
  • 3
    It is only needed if you have [Lazy Loading proxies](https://learn.microsoft.com/en-us/ef/core/querying/related-data/lazy). – Svyatoslav Danyliv Oct 18 '22 at 07:45
  • What, specifically don't you understand about this? For example do you understand the purpose of the virtual keyword (in other words, have you read this page? https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/virtual), and are just asking specifically about ICollection being virtual? Vice versa? Or are you asking for someone to explain both what an ICollection is and what the virtual keyword does? – TylerH Oct 18 '22 at 19:11
  • https://stackoverflow.com/questions/70581816/how-to-seed-data-in-net-core-6-with-entity-framework https://csharp-video-tutorials.blogspot.com/2014/05/part-6-how-to-seed-database-with-test.html https://code-maze.com/migrations-and-seed-data-efcore/ – Billu Oct 18 '22 at 19:22

0 Answers0