Should the POCO ID property be case sensitive for RavenDB?

I am using sample data from the Music Store and I have a POCO like:

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 get the data, the ID property is NULL. If I change the property to Id it gets populated. This seems to imply that the property must be specific.

Here's 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 POCO genre and artist, changing the POCO ownership case is irrelevant. Interestingly, this is because its explicitly listed as a property in JSON, whereas the Id in the album is not.

+3


source to share


1 answer


By default we are looking for a property named "Id" and yes, it has a value in the property name.

You can change this agreement by changing Conventions.FindIdentityProperty



eg,

+2


source







All Articles