I seem to be having a random issue with nHibernate and inserting records.
Insert was working fine, then added a new table, and started receiving the error:
Cannot insert explicit value for identity column in table '' when IDENTITY_INSERT is set to OFF
The existing tables insert also now fails. The random part comes in that if I delete my files, and re-checkout, the insert then works fine.
nHibernate version is 3.1
The identity columns is being set via:
[NHibernate.Mapping.Attributes.Generator(Class = "native")]
[NHibernate.Mapping.Attributes.Id(Name = "id")]
public virtual IdT id
{
get { return _id; }
set { _id = value; }
}
I tried setting to "identity", but still an issue. Not sure if there is a caching problem, but worried it could affect functionality at a later stage.