Force.com-Toolkit-for-NET icon indicating copy to clipboard operation
Force.com-Toolkit-for-NET copied to clipboard

Createable/Updateable attributes don't work on properties with a custom JsonProperty name

Open avesse opened this issue 8 years ago • 0 comments

Example:

[Createable(false), Updateable(false)]
[JsonProperty("Salesforce_Name__c")]
public string DotnetName { get; set; }

The CreateableContractResolver and UpdateableContractResolver will not work in this case, since it's comparing the wrong property names. This can be fixed by replacing

var propInfo = type.GetRuntimeProperty(property.PropertyName);

with

var propInfo = type.GetRuntimeProperty(property.UnderlyingName);

in those two classes.

avesse avatar Jun 27 '17 07:06 avesse