ServiceStack:索引的属性不起作用?

问题描述 投票:1回答:1

我正在尝试使用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,除此之外没有其他:

<< img src =“ https://image.soinside.com/eyJ1cmwiOiAiaHR0cHM6Ly9pLnN0YWNrLmltZ3VyLmNvbS83bE5tOC5wbmcifQ==” alt =“在此处输入图像描述”>

我在这里想念什么?

c# mysql ormlite-servicestack
1个回答
0
投票

出于无法解释的原因,它突然开始工作。我不确定这可能是DLL或某些东西的“缓存”问题,但它开始使用属性。

只需回答一下,我就可以“关闭它”)(

© www.soinside.com 2019 - 2024. All rights reserved.