dotnet / EntityFramework.Docs

Documentation for Entity Framework Core and Entity Framework 6
https://docs.microsoft.com/ef/
Creative Commons Attribution 4.0 International
1.56k stars 1.94k forks source link

add virtual keyword to properties #4690

Open rominator1983 opened 1 month ago

rominator1983 commented 1 month ago

virtual seems to be missing as pointed out in the comments of this answer: https://stackoverflow.com/a/22708800 I also needed that for the migration to work at all.

roji commented 1 month ago

That comment only seems to say that a DbSet property is needed, not that it must necessarily be virtual. You definitely shouldn't need to make DbSet properties virtual; if you're running into issues, can you please open an issue on the main EF Core repo with a full, runnable code sample?