Have you tried setting the unsaved-value
attribute?
<id name="Id" column="Id" type="Guid" unsaved-value="00000000-0000-0000-0000-000000000000"> <generator class="guid.comb" /> </id>
edit Now I understand that your question is a completely different option instead of deploying your own generator - is to use
<generator class="assigned" />
However, you cannot use SaveOrUpdate()
. Instead, you must explicitly tell NHibernate if the object should be saved or updated by calling Save () or Update () ISession. Also, you always need to manually specify the GUID for all your new objects. Its an option.
source share