I am using NHibernate Mapping by code with MYSQL, and have mapping as below :-
Id(x => x.Id, map => { map.Column("ID"); map.Generator(Generators.Native); });
and database as below :-
ID int not null AUTO_INCREMENT
i used Generators.Native because database will generates its id by AUTO_INCREMENT . But i would like to manually set id (Id=10) in some cases. How can i change the mapping, if Id=0 then use 'AUTO_INCREMENT' else use the already set Id which is 10.
I checked on internet and got this link (Custom Id Generator) but its for Java + Hibernate. I don't know how to convert this inNHibernate mapping by code for C#.