We are using string.GetHashCode()
to identify a unique string identifier as an integer in our application (in a location where the ID is required to be an Integer).
Since this is a key field for a particular table in our database I need to be able to reference it from time to time in a LINQ query.
Of course, this fails with the error:
LINQ to entities does not recognize the method 'blah'
We get around that in a few places by post processing the query and adding the relevant data to the collection after the query... but in one particular query the results are just too large and the post processing is just not going to work.
So, my question is simple, but maybe not so simple to answer: Is there a best way to incorporate the use of string.GetHashCode()
inside a linq query?
I have tried to create a Dictionary<string, int>()
, but LINQ does not like querying that object either :/
Any help appreciated!
Dave