Question

Can I map the identity of an entity to a column whose values are not automatically generated, but is still unique?

If so, what should I put in the xml identity/generator tag?

Thanks.

Was it helpful?

Solution

It depends on how new identity values are created. My guess here would be to use if you are giving the values to new rows manually (before they are saved). FYI -- if you use the assigned generator:

Due to its inherent nature, entities that use this generator cannot be saved via the ISession's SaveOrUpdate() method. Instead you have to explicitly specify to NHibernate if the object should be saved or updated by calling either the Save() or Update() method of the ISession.

Generator Documentation

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top