Closed zhunter closed 12 years ago
To fix my problem, I added the following line before SetPrimaryKey(pkVal) in ActiveRecord.cs.
pkVal = Convert.ChangeType(pkVal, BaseSchema.PrimaryKey.GetPropertyType());
Now my object.Equals() call works perfectly and my CompareTo() function correctly returns only the columns that have values different between the two objects.
This has been merged into the trunk. Thanks.
I've been trying to add a function to compare my object TableColumnSettings. When I load 2 objects using the FetchByID they match, when I change one object by editing/saving a column always get the changed column and the primary key to fail the Equals() check. I noticed the datatype on my primary key changed from Int16 to Int32 after calling Save(). I see that the SqlDataProvider.cs, ExecuteQuery(QueryCommand qry) returns a int and ActiveRecord.cs Save() calls SetPrimaryKey(pkVal) that passes on the Int32 to the current object which is causing it to go from a Int16 to a Int32, and thus fail the Equals() check. Easy fix is to reload and compare, but I wanted to share what I found after pulling out a handful of hair.