May 19, 2012

The argument types 'Edm.Guid' and 'Edm.String' are incompatible


Error:
- The argument types 'Edm.Guid' and 'Edm.String' are incompatible for this operation. Near equals expression, line X, column Y.
- ObjectQuery<T>.Where problem with GUID
- Where filter predicate format is not match with GUID and ...

Solution:
The GUID format in where clause must be started with GUID term and covered with single quotation, like below

X.Where("it.ID = GUID'00000000-0000-0000-0000-000000000001'");

2 comments:

Anonymous said...

It was a awe-inspiring post and it has a significant meaning and thanks for sharing the information.Would love to read your next post too……

Sasha_Beluj said...

Thank you for this info!
I tried to implement Generic Repository pattern with Id of type Guid. I spent a lot of time trying to do this. In NHibernate this can be done really easily. F*ck EF =\