Using a non-int ID field

Nov 2, 2010 at 4:16 PM

I need to be able to generate a database and classes with a different ID field to int. It may be either bigint or GUID.

Am I right in thinking that nHydrate does not support this?

And if so, can you let me know how hard you think it would be to customise so it does, and give me any pointers to start me off if it's at all achievable?

Thanks

Iain

Coordinator
Nov 6, 2010 at 2:21 AM

I need more clarification to reproduce this issue. I have created a model with a table with a BigInt primary key and another table with a GUID PK. I have added values to a database and all is well. Please send your model or database to chrisd@nhydrate.org. Please explain what exactly you are trying to do.

Nov 8, 2010 at 1:06 PM

Hi Chris, my mistake - sorry! I'd been using the Type tables earlier (which does, I believe, insist on an int Id field) and I'd got the two situations muddled up in my mind.

However, I would be interested to know if there is any way now (or any plans for the future) to support composite primary keys e.g. an int identity field and a machine name? We are looking at merging data from multiple database servers together and are trying to find a good way to keep records unique, and composite keys are one of a number of options (as well as using GUIDS, and bodging the data during the merge).

Thanks!

Coordinator
Nov 8, 2010 at 5:15 PM

You can mark two fields in a table as primary key and that is a composite key. This is supported now.