ServiceStack: Attribues for indexes not working?

末鹿安然 提交于 2019-12-11 07:41:06

问题


I am trying to use the attributes in ServiceStack.DataAnnotations to mark the properties in my POCOs so that the tables have the correct indexes, but it does not seem to work.

My POCO:

public class AlfaTo
{
    [ServiceStack.DataAnnotations.Index(Unique = true)]
    [ServiceStack.DataAnnotations.AutoIncrement]
    public long id { get; set; }
    [ServiceStack.DataAnnotations.Index(Unique = false)]
    public string protocol { get; set; }
    [ServiceStack.DataAnnotations.Index(Unique = false)]
    public DateTime timestamp_created { get; set; }
    public DateTime timestamp_receivedServer { get; set; }
    public string data { get; set; }
    [ServiceStack.DataAnnotations.Index(Unique = false)]
    public long responseId { get; set; }
}

Code to create the table:

dbConnCommOrm.CreateTableIfNotExists<AlfaTo>();

And the result shows that the only thing created is the PrimaryKey for "Id", nothing else:

What am I missing here?


回答1:


For unexplained reasons, it suddenly started to work. Maybe it was some "cache" problem with DLLs or something, I am not sure, but it started to work with the attributes.

Just answering this so I can "close it" )(



来源:https://stackoverflow.com/questions/19891992/servicestack-attribues-for-indexes-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!