I have a piece of code such as below:
Code:
public bool IsTaskAllowed(Task task)
{
bool retVal = false;
foreach(Task t in this.Tasks)
{
if (t == task)
{
retVal = true;
}
}
return retVal;
}
In the above code, the Task object being passed in came from the 2nd level cache (I verified this by SQL profiling). However, the above code returns false, even though I know for sure, that the passed in task object is a member of this.Tasks. It appears to me, that after enabling the 2nd level cache, the objects retrieved from the cache are treated like "2nd class", which means that code written like above will fail.
Is the above behaviour expected?