2013-03-12 89 views
1

我在學習servicestack.ormlite,我遇到了這個問題。OrmLite是否支持MetadataType屬性?

當我使用此POCO時,出現主鍵錯誤。

這讓我覺得MetadataType屬性沒有任何效果,並且我將autoincrement屬性賦予了名爲User的類中的屬性「Id」。

這樣,代碼正常工作。原因可能是因爲使用MetadataType屬性錯誤或者ORMLITE對MetadataType屬性的支持。

[MetadataType(typeof(UserMetadata))] 
public partial class User 
{ 
    public int Id { get; set; } 
    public string Name { get; set; } 
    public string SurName { get; set; } 
} 


public class UserMetadata 
{ 
    [AutoIncrement] 
    public int Id { get; set; } 
} 

回答