Operator '==' cannot be applied to operands of type 'System.Guid' and 'string' in linq to entity

前端 未结 7 829
礼貌的吻别
礼貌的吻别 2020-12-18 21:12

I am getting this error \'Operator \'==\' cannot be applied to operands of type \'System.Guid\' and \'string\'\' in linq to entityframework below code. in the below code Cus

7条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-18 22:02

    Change it to:

    var accountQuery = from C in CustomerModel.CustomerProfile
                      where C.CustomerId.ToString() == customerProfileId                
                     select C;
    

    Or parse your customerProfileId to a Guid and use that in the query.

提交回复
热议问题