【发布时间】:2013-11-10 16:18:05
【问题描述】:
我正在尝试使用 ServiceStack.DataAnnotations 中的属性来标记我的 POCO 中的属性,以便表具有正确的索引,但它似乎不起作用。
我的 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; }
}
创建表的代码:
dbConnCommOrm.CreateTableIfNotExists<AlfaTo>();
结果显示,唯一创建的是“Id”的 PrimaryKey,没有别的:
我在这里错过了什么?
【问题讨论】:
-
更新:由于无法解释的原因,它突然开始工作。也许是 DLL 的一些“缓存”问题或其他什么......
标签: c# mysql ormlite-servicestack