I have a Users table where the "ID" field is a GUID field.
Using ASPNET I am creating a user account and getting the GUID back. I am trying to create associated records in my tables with that GUID as the main ID.
The problem I am running into is that when I manually set Users.ID NHibernate tries to do an Update, not an Insert. I see this with the NHibernate Profiler before it bombs out with "Unexpected row count: 0; Expected: 1".
My UsersMap for the table Users looks like:
public class UsersMap : ClassMap<Users>
{
public UsersMap()
{
Id(x => x.ID, "ID"); //GUID
Map(x => x.Name, "Name"); //string
Map(x => x.PhoneNumber, "PhoneNumber"); //string
Map(x => x.FaxNumber, "FaxNumber"); //string
Map(x => x.EmailAddress, "EmailAddress"); //string
HasMany<UsersAddressBook>(x => x.usersAddressBook).KeyColumn("ID");
}
}
Any ideas? Thanks in advance.