IdNotSetException

That is not a bug, but a desired behavior. Zero is considered a null id. When you have an object with a property Id: Integer, it's the way Aurelius tell that such class is transient and needs to be inserted and get a new id (or that the class doesn't have an id yet and generate an error if it's not auto generated).


There is an undocumented attribute named IdUnsvedValue that you can use to work around that. That attributes allow you to change the default "null id" value, which is 0 by default:



  [Entity, Automapping]
  [IdUnsavedValue(-1)]
  TUnsavedValue = class


This way Aurelius will understand that when ID is -1 then that's when the class doesn't have an id. You must be sure to initialize your property with that value when a class is created otherwise Aurelius will always try to update the data (and not insert).