MattNorman
Well-known member
- Joined
- May 22, 2021
- Messages
- 98
- Programming Experience
- 1-3
I am using EF with a C# .NET 7 app.
For some reason, related entities are not being loaded when using the Include() method:
This has not been an issue for any of my other database entities. I have tried dropping and recreating the tables, however still no luck.
If I manually load the related entities using the Load() method for each record, I get the data back.
Has anyone had a similar issue and know what the cause may be? I want to avoid having to manually loop through the records and manually loading the related entities where possible.
For some reason, related entities are not being loaded when using the Include() method:
C#:
using var db = new ApexImContext();
var test = db.StorageRequestsVirtuals.Include(sr => sr.Reason)
.Include(sr => sr.VirtualServer)
.Include(sr => sr.Volume).ToList();
This has not been an issue for any of my other database entities. I have tried dropping and recreating the tables, however still no luck.
If I manually load the related entities using the Load() method for each record, I get the data back.
Has anyone had a similar issue and know what the cause may be? I want to avoid having to manually loop through the records and manually loading the related entities where possible.