Than that new name writes to properties list of schema definition.
In case if new name (from DataMemberAttribute) is not same to the type's property name, this code in method ApplyEdmModelPropertyNamesToSchema thew exception
...
foreach (var property in schemaDefinition.properties)
{
var currentProperty = type.GetProperty(property.Key, BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance);
//currentProperty = null because type doesn't contains changed name
var edmPropertyName = GetEdmPropertyName(currentProperty, edmType);
//GetEdmPropertyName calls GetPropertyNameForEdmModel internally
...
}
Question: Why does any logic have to override names of already setup-ed? Why there is a dependency only on DataMemberAttribute (not to JsonPropertyAttribute)?
I've faced to the following problem: GetPropertyNameForEdmModel retrieves name of EDM property from DataMemberAttribute if it exists.
Than that new name writes to properties list of schema definition. In case if new name (from DataMemberAttribute) is not same to the type's property name, this code in method ApplyEdmModelPropertyNamesToSchema thew exception
Question: Why does any logic have to override names of already setup-ed? Why there is a dependency only on DataMemberAttribute (not to JsonPropertyAttribute)?
Could it be a possible fix is?