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

前端 未结 7 831
礼貌的吻别
礼貌的吻别 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:07

    var accountQuery = from C in CustomerModel.CustomerProfile
                  where C.CustomerId == new Guid(customerProfileId) // Error here                    
                 select C;
    

    you need to generate new guid from the string and it should work

提交回复
热议问题