Very new to NHibernate so I expect there will be a quick fix here.
The code I'm looking at has an unorthodox design.
public class Partner
{
public virtual int Id { get; set;} //note the set is not private
public virtual String Name { get; set;}
}
and is mapped with FluentNhibernate's Automappings
When Partner
is created its Id is 0 but when
I call Flush to persist to the db:
CurrentSession.SaveOrUpdate(obj);
CurrentSession.Flush();
I get a Unexpected row count: 0; expected: 1
StaleStateException
I'm assuming its because NHibernate doesn't like me changing the Primary Key, Id. In this case I need to. How can I configure NH to let me achieve this abomination?