EF Core expression with object instead of generic parameter
I have a method which searches for an entity, and optionally loads navigation properties: public async Task<Person?> FindPerson<TProperty>(string name, params Expression<Func<Person, IEnumerable<TProperty>>>[] includes) where TProperty : class { var person = await Find(name); if (person != null) { foreach (var include in includes) await _context.Entry(person).Collection(include).LoadAsync(); } } (Note that is a very simplified version of … Read more