【问题标题】:ServiceStack: Attributes for indexes not working?ServiceStack:索引的属性不起作用?
【发布时间】: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


【解决方案1】:

由于无法解释的原因,它突然开始工作。也许是 DLL 的一些“缓存”问题,我不确定,但它开始与属性一起工作。

只要回答这个问题,我就可以“关闭它”)(

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-05-18
    • 2011-12-23
    • 1970-01-01
    • 1970-01-01
    • 2019-02-12
    • 1970-01-01
    • 2022-01-18
    • 1970-01-01
    相关资源
    最近更新 更多