2012-03-17 47 views
3

我使用的音乐商店的样本数据,我有一个POCO像这样:是否一个ID POCO属性必须案例RavenDB敏感?

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; } 

} 

然而,当我检索数据的ID属性为null。如果我将属性更改为Id,那么它将被填充。这似乎表明该财产必须是某种情况。

下面是数据:

{ 
    "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" 
    } 
} 

有趣的流派&艺术家POCO改变POCO属性的情况下,不会有所作为。我不知道它的,因为它明确表明其在JSON,而标识在相册的属性是没有的。

回答

2

默认情况下,我们寻找名为“Id”的属性,并且在属性名称中是套管事项

您可以通过改变Conventions.FindIdentityProperty

+2

出于兴趣改变这种惯例为何它没有问题,如果流派/艺术家POCO是ID或ID,因为无论卧牛它被填充 – Jon 2012-03-17 12:26:56

相关问题