This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I am using KeyTable as my models identity method but I am in a situation where I need to get a new Entity's id before it is saved, and KeyTable only assigns the id when an entity is saved. How can I get the id assigned before the save? Manually getting a KeyTable id and assigning it using GenerateId() on an entity would also work. |
|
|
[quote user="James Newton-King"]KeyTable only assigns the id when an entity is saved[/quote] That is incorrect. KeyTable assigns the ID when the entity joins a unit of work (via the Add method, or by being associated with another entity that is already part of a UOW). In fact, all identity methods except IdentityColumn work this way. |
|
|
Awesome! I hadn't noticed. Out of interested do Guid identities work like that as well or can they get an id generated prior to being associated with a UOW? They're what I've used a lot in the past. |
|
|
Guid identities work the same way. They do not get an ID generated prior to being associated with a UOW. |
|