I am using the Music Store sample data and I have a POCO like so:
public class Album
{
public Genre Genre { get; set; }
public Artist Artist { get; set; }
public string ID { get; set; } /***** NULL *****/
public string AlbumArtUrl { get; set; }
public double Price { get; set; }
public string Title { get; set; }
public int CountSold { get; set; }
}
However when I retrieve the data the ID property is null. If I change the property to Id then it is populated. This seems to suggest that the property has to be a certain case.
Here is the data:
{
"AlbumArtUrl": "/Content/Images/placeholder.gif",
"Genre": {
"Id": "genres/1",
"Name": "Rock"
},
"Price": 8.99,
"Title": "Let There Be Rock",
"CountSold": 0,
"Artist": {
"Id": "artists/1",
"Name": "AC/DC"
}
}
Interestingly for the Genre & Artist POCO changing the case of the POCO property doesn’t make a difference. I wonder if its because its explicitly stated as a property in the JSON whereas the Id in the Album is not.
By default, we look for a property named “Id”, and yes, casing matters in the property name.
You can change that convention by changing the
Conventions.FindIdentityPropertyeg