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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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