问题
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