OrmLite support for SEQUENCES in ID columns instead of IDENTITY?

Hi everyone.

In SqlServer I prefer to uses sequences instead of identity to generate auto-increment values.
But in this case the LastInsertId() method does not work.
To use sequences the insert sql statement needs to use the OUTPUT clause.

Does OrmLite has support for this with the SqlServer dialect provider?
Like it does in the FireBird dialect provider?



No all Dialect Providers only support one way for implementing auto incrementing IDs for SQL Server it’s using IDENTITY columns which it fetches with SELECT SCOPE_IDENTITY().

You would need to manually retrieve the value from the sequence with something like:

row.Id = db.Scalar<int>("SELECT NEXT VALUE FOR MySequence");