Hi,
As listed on another thread, I using the below to try to insert an identity
if (account.Id != 0)
{
typeof(Account).GetModelMetadata().PrimaryKey.AutoIncrement = false;
conn.SetIdentityInsert<Account>(true);
}
conn.Insert(account);
The SetIdentityInsert extension method is my own, but I get the following:
Insert Failure. Explicit value must be specified for identity column in table 'Account' either when IDENTITY_INSERT is set to ON or when a replication user is inserting into a NOT FOR REPLICATION identity column..
So it appears the IDENTITY_INSERT is on, but OrmLite is not passing the Id into the insert statement.
My Primary Key property looks like:
[Alias("AccountID")]
[PrimaryKey]
[AutoIncrement]
public override long Id { get; set; }
Any ideas?
G