Reputation: 2078
I have this code to return all employees in my db. Each employee contains a collection of dependents.
var employees = _dbContext.Employees.Include(e => e.Dependents).ToList();
Problem is, it's telling me Include()
can only take in a string. I know I've used it with a lambda expression in the past. Why won't it let me now?
If I do use Include("Dependents")
it does work correctly, but I'd like to avoid relying on a string.
Upvotes: 0
Views: 71
Reputation: 2078
Per the comments, I tried using System.Data.Entity
and it fixed my problem. Thanks!
Upvotes: 3