Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to .Ignore() readonly properties. #26

Open
timmi4sa opened this issue Jan 29, 2020 · 0 comments
Open

Unable to .Ignore() readonly properties. #26

timmi4sa opened this issue Jan 29, 2020 · 0 comments

Comments

@timmi4sa
Copy link

This library is Amazing!!! I keep evangelizing it for years.

Unless I am doing something wrong, I can't seem to successfully ignore a read-only property.

We have a graph as follows:

CaseDto (primary object to compare)
It has a public property "Client" of class ClientDto.
ClientDto has a readonly property (below) titled "AddressParts", this property appears as a Difference even though the property is mentioned in .Ignore(client => client.AddressParts) in configuration of type ClientDto (other ignored properties are ignored perfectly):

public class ClientDto
{
..
public string[] AddressParts => AddressStringHelper.ConstructTwoLineAddressParts(
AccountLocation?.AddressLine1,
AccountLocation?.AddressLine2,
AccountLocation?.City,
AccountLocation?.StateProvince,
AccountLocation?.ZipCode
);
}

Example of the Difference instance (if serialized to JSON):

{
"$type": "AutoCompare.Difference, AutoCompare",
"Name": "Client.AddressParts",
"OldValue": {
"$type": "System.String[], mscorlib",
"$values": [ "Street address", "SÃO PAULO, BRAZIL N/A" ]
},
"NewValue": {
"$type": "System.String[], mscorlib",
"$values": [ "Street address", "SÃO PAULO, BRAZIL N/A" ]
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant