Entity Framework - Cannot convert lambda expression to type 'string' because it is not a delegate type

后端 未结 15 2232
再見小時候
再見小時候 2020-11-30 09:18

I am using Entity Framework in my C# based code. I am running into an unexpected weirdness and am looking for suggestions.

Case 1, 2, 3, 4... Projects:
RivWorks

相关标签:
15条回答
  • 2020-11-30 10:17

    In my case, I had the

    Using System.Linq;
    

    but I was missing the && after a where clause item.

    Bad Code:

    item.Group.ID == grp.ID
    p.Product_Status_Flag == 1 &&
    item.Valid
    

    Correct Code ( with no error ):

    item.Group.ID == grp.ID && // <- This was missing and I didn't see it right away.
    p.Product_Status_Flag == 1 &&
    item.Valid
    

    I hope this saves someone some time.

    0 讨论(0)
  • 2020-11-30 10:20

    Just Try using System.Linq; I think it will help you to sort out this issues.

    0 讨论(0)
  • 2020-11-30 10:21

    In my case I had this error when trying to use Include in clientContext.Load in a Sharepoint 2013 app.

    I had included Sharepoint client library like so:

    using SP = Microsoft.SharePoint.Client;
    

    To fix, in addition I also added it without the namespacing:

    using Microsoft.SharePoint.Client;
    using SP = Microsoft.SharePoint.Client;
    
    0 讨论(0)
提交回复
热议问题