Using Sequences

The Entity framework doesn't support sequence mapping, other than mapping of system sequences (e.g. @@IDENTITY or SCOPE_IDENTITY()). This means that when you use a database which requires the usage of schema sequences, like Oracle or PostgreSql, the sequences assigned to mappings are ignored by the as there's no way to specify the usage of a specific sequence in the Entity Framework's Edmx file.

To work around this, you have to define an insert trigger on tables which use a sequence in databases which don't support identity fields, if you want to have sequenced PK field values. This has to be done for PostgreSql, Firebird and DB2 (if you choose to use sequences).

For databases which do support identity fields, like DB2 as well as SQL Server, nothing has to be done: you can map a system sequence in the field mappings and it's properly picked up by the designer as an identity field and marked as such in the Edmx file.