I have one online database on wcf and one offline database. I want to synchronize those so I started with mapping the online data into an object of offline data.
List<com.somee.wobservice.Customer> onlineCus = myservice.QueryCustomer();
List<Customer> offlineCus = dbc.Customers.ToList();
List<Customer> onlineCusMap = new List<Customer>();
foreach (com.somee.wobservice.Customer c in onlineCus)
{
Customer cus = new Customer();
cus.customer_id = c.customer_id;
cus.customer_name = c.customer_name;
cus.customer_email = c.customer_email;
cus.password = c.password;
cus.balance = c.balance;
onlineCusMap.Add(cus);
}
Now, I have 2 objects of the class Customer (a table in my database). But when I compared to get the except from them, it returned all data of the offline database (suppose to be no data because the data in those objects are same)
List<Customer> toInsert = offlineCus.Except(onlineCusMap).ToList();
Any suggestion to compare those 2 objects?
Customerclass overrideEqualsandGetHashCode? If not, that's why it's not finding any duplicates.