【问题标题】:How can I Map enum properties to int in ServiceStack.OrmLite?如何将枚举属性映射到 ServiceStack.OrmLite 中的 int?
【发布时间】:2012-08-23 04:37:39
【问题描述】:

也许答案是“设计使然”。但是枚举属性主要用于过滤。所以他们需要“数据库索引”。但是如果你将它们映射到 varchar(max) 我们无法在 Sql Server 中为它们创建索引。

因此,如果答案是“按设计”,您是否可以添加 [Flag] 样式绑定替代方案。

【问题讨论】:

    标签: ormlite-servicestack


    【解决方案1】:

    这对我来说是架构错误,没有解决方案。

    所以我们做了

    int UserTypeId {get;set,} // It is for db
    UserTypeEnum UserTypeEnum {get;set;} // It manipulates UserTypeId and read from UserTypeId
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-07-05
      • 1970-01-01
      • 2021-07-31
      • 1970-01-01
      • 1970-01-01
      • 2019-08-14
      • 2018-03-20
      相关资源
      最近更新 更多