EF Core no .Include() method on DBset

后端 未结 3 879
醉梦人生
醉梦人生 2021-02-12 12:30

I\'m currently completely unable to call .Include() and intellisense (in vscode) doesn\'t seem to think it exists.

Now after a long time searching the web I\'ve found th

相关标签:
3条回答
  • 2021-02-12 12:52

    It's a direct consequence of a missing reference in the file where I'm making a call to the method (though i'm not quite sure i understand how...)

    Anyways, adding:

    using Microsoft.EntityFrameworkCore;
    

    like Tseng and Smit suggested, did the trick. (in the file in which i define the function)

    Though why that works i have no idea. I thought .include would automatically be available through the DbSet.

    Thanks though! :)

    0 讨论(0)
  • 2021-02-12 12:57

    If you end up here, a user of EF 6 or below and happen to miss that OP actually mentioned this like I did, you want to add

    using System.Data.Entity;
    

    to your class.

    0 讨论(0)
  • 2021-02-12 13:10

    Here is a previous answer that is tracking this issue in EF7. It appears it is now 'included'.

    0 讨论(0)
提交回复
热议问题