I am using Guid's as ID's in my classes/database. How do you tell NHibernate to save the Guid when it is all zeros? The mapping that I am currently using is:
Code:
<id name="ID" type="Guid" unsaved-value="00000000-0000-0000-0000-000000000000">
<column name="CustomerID" sql-type="uniqueidentifier" not-null="true" unique="true" index="PK_tblCustomer"/>
<generator class="native" />
</id>
I cannot use <generator class="assigned" /> becase there are other systems modifying customer records and the Guid assignment needs to be handled by the database.
The error I get is:
Quote:
Could not create test BE, Exception:NHibernate.Id.IdentifierGenerationException: this id generator generates Int64, Int32, Int16 ---> System.InvalidCastException: Invalid cast from 'System.DBNull' to 'System.Guid'.
Any help/ideas? Thanks in advance.