EF Core Second level ThenInclude missworks

前端 未结 2 890
礼貌的吻别
礼貌的吻别 2020-11-22 09:09

Assume having these models first:

Method that has one OriginalCode OriginalCode that has many Mutants Mutan

相关标签:
2条回答
  • 2020-11-22 09:20

    This is a known Intellisense issue with the ThenInclude overload for collection type navigation properties, tracked by the Completion missing members of lambda parameter in fault tolerance case #8237 Roslyn GitHub issue.

    Until it gets fixed, simply type the name of the property and it will compile successfully and work as expected.

    .ThenInclude(mu => mu.ParseSubTrees) 
    

    Update: Now it's even specifically mentioned in the Including multiple levels section of the EF Core documentation:

    Note

    Current versions of Visual Studio offer incorrect code completion options and can cause correct expressions to be flagged with syntax errors when using the ThenInclude method after a collection navigation property. This is a symptom of an IntelliSense bug tracked at https://github.com/dotnet/roslyn/issues/8237. It is safe to ignore these spurious syntax errors as long as the code is correct and can be compiled successfully.

    0 讨论(0)
  • 2020-11-22 09:38

    In my case there was a conflict between the namespaces System.Data.Entity and Microsoft.EntityFrameworkCore. Just delete the first using line.

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