InMemoryPersistor and Autoincrement Ids (Identity Columns)

Feb 15, 2012 at 2:18 PM

Is there any mechanism in the NakedObjects framework to get the InMemoryPersistor to assign simulated autoincrement ids for identity columns?

Feb 15, 2012 at 2:27 PM
Edited Feb 15, 2012 at 2:29 PM

I was thinking of modifying the T4Template to check whether the EDMProperty value uses a store generated pattern,

If it did I thought I could codegen a static field and that would conditionally get incremented when a new instance is persisted (only if the type of the objectpersistor was InMemoryPersistor).  This incremented value woud then be assigned to the EDMProperty field .

Feb 15, 2012 at 7:13 PM

If you just annotate your integer Id property with [Key] then the InMemoryObjectStore should do this.  And this should have no impact when running with EF.

Feb 16, 2012 at 2:39 PM

Thanks.  Can't believe that I missed that in the docs.  Apologies.