This shows a sample implementation of a custom id generator for numeric data types.
You have to write a custom id generator when a new entity's permanent key must be calculated with information only accessible on the EntityServer. The key is not generated by the database (store-generated) nor can it be assigned in creation code on the client.
You can implement an IIdGenerator to handle custom id generation. This sample NumericIdGenerator can be used as is or adapted for use in your application. The sample will handle numeric data types: first assigning a negative temporary id and then assigning a real id using a NextId database table.
If you use the NumericIdGenerator as is you will need a NextId database table. The script to create this table is in the download.