EF 6 - Include Why Do I not have linq choice?

c# entity-framework linq

Question

I am a bit confused on why I don't get linq.

context.Users.Include(x => x.Roles)

I can't do this I have to do context.Users.Include("Roles")

Seems like other people can do it.

EF Code first Eager loading and OrderBy problem

Do I need to import something? Has something changed in EF 6(rc1)?

1
16
5/23/2017 11:47:17 AM

Accepted Answer

If you're using DbContext, the correct namespace to import is:

using System.Data.Entity;

This is the namespace that contains DbExtensions that provides the type-safe versions of the .Include method.

54
10/18/2013 11:06:34 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow