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

前端 未结 7 858
礼貌的吻别
礼貌的吻别 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 21:53

    Can you do a C.CustomerId.toString() == customerProfileId or replace customerProfileId with new Guid(customerProfileId)

    The second one should be faster as its only one conversion and guid compares are faster than string compares.

提交回复
热议问题