开发者

How To Disable Subsonic's Primary Key Autoincrement?

开发者 https://www.devze.com 2022-12-23 06:08 出处:网络
I\'m using Subsonic (simplerepository) and SQLite, and I have a class with an Int64 property marked as [SubSonicPrimaryKey]:

I'm using Subsonic (simplerepository) and SQLite, and I have a class with an Int64 property marked as [SubSonicPrimaryKey]:

[SubSonicPrimaryKey]    
public Int64 MyID;
开发者_开发百科

which is transformed into:

[MyID] integer NOT NULL PRIMARY KEY AUTOINCREMENT

Is it possible to disable the AUTOINCREMENT feature?


Well, I found it by myself. Autoincrement feature is automatic and cannot be switched off. Here's what the code does:

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

精彩评论

暂无评论...
验证码 换一张
取 消