【问题标题】:How To Disable Subsonic's Primary Key Autoincrement?如何禁用 Subsonic 的主键自动增量?
【发布时间】:2010-03-16 15:08:17
【问题描述】:

我正在使用 Subsonic (simplerepository) 和 SQLite,并且我有一个带有标记为 [SubSonicPrimaryKey] 的 Int64 属性的类:

[SubSonicPrimaryKey]    
public Int64 MyID;

转化为:

[MyID] integer NOT NULL PRIMARY KEY AUTOINCREMENT

是否可以禁用自动增量功能?

【问题讨论】:

    标签: c# subsonic primary-key auto-increment


    【解决方案1】:

    嗯,我自己找到的。自动增量功能是自动的,不能关闭。以下是代码的作用:

            if(column.IsPrimaryKey)
            {
                sb.Append(" NOT NULL PRIMARY KEY");
                if(column.IsNumeric)
                    sb.Append(" AUTOINCREMENT ");
            }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-04-21
      • 2012-12-14
      • 2012-01-21
      • 2011-06-08
      • 2013-04-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多