I’m using a query that tries to find a matching unique identifier (guid) such as
var myUsers = from u in table
where u.UniqueIdentifierId == MyClass.GetCurrentUserId()
select u;
This throws the Method Not Supported error for my custom function. I recoded it to do this
string guid = MyClass.GetCurrentUserId().ToString();
where u.UniqueIdentifierId.ToString() == guid
And this works. I want to know if there are any other work arounds that do not require creating a temporary variable. Thanks.
You can’t call it in the query, because LINQ to SQL can’t translate this. It tries to transform this in a SQL call. What you must do is call this method outside of the LINQ query, as follows: