I have two in my application contexts, both are equal in schematic & Structure, one is on a remote server and the other is the local server installed on the computer. It is assumed that both databases are the same but with different data, I try to do is get all the data from both contexts for comparison and so can I have the same data in both databases. Use the Distinct extension method does not work the same. My class is called Users and their attributes are: ID, Name, Last Name, User, Password. The ID field is Identity Not null. Now I have only an identical record in both databases, therefore, to use the Distinct should not return data but I returned them. I checked the hash with the GetHashCode method and these are different. Here is my code:
foreach (var item in remote.Users)
lstUsers.Add(item);
foreach (var item in local.Users)
lstUsers.Add(item);
var results = lstUsers.Distinct().ToList();