EDIT, this is not a duplicate. The suggested SO links want me to call
ToString() but I am running a
.COUNT() and trying to do a greater than comparison so calling
ToString() is not a correct answer.
I am trying to fill a variable using the
IF shortcut but when I run it I get the error
LINQ to Entities does not recognize the method 'System.Guid Parse(System.String)' method, and this method cannot be translated into a store expression.
The code I am running is
IsAdmin = (db.yaf_prov_RoleMembership .Where(rm => rm.UserID == UserKey && rm.RoleID == Guid.Parse("adsfasd654asdf816asdf")) .Count() > 0) ? true : false;
If I take away the
Guid.Parse and do a straight up comparison then I get the error
Operator == cannot be applied to operands of type System.Guid and String
What needs to be done in order to compare a GUID to a string in a LINQ query?