How To Disable Subsonic's Primary Key Autoincrement?
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 ");
}
精彩评论