The problem is it is turning your Contains()
in to a SQL call so no matter what you put in Equals
and GetHashCode()
it won't matter because the database you are connecting to does not use them for testing equality (This is why "This" == "this"
will return true
when working with entity framework on a database who's collation is not case sensitive).
The "quick and dirty" way to fix it is to realize the collection in memory and then do the .Contains
QuestionSetAssignees.AsEnumerable().Contains(director))
But that will not give you very good performance. You will likely need to approach this query a different way so the SQL behaves like you want it to.
I think the following may work, but please test it and let me know if it does not, I will remove it.
QuestionSetAssignees.Select(assignee => assignee.Id).Contains(director.Id)