If you want to edit an existing entity, you shouldn't create a new instance and add/attach it to the context. The AttachCopy()
method is used when you want to attach objects that have been previously detached, or objects that have been retrieved outside the OpenAccessContext
If you want to Edit/Delete/Read an existing entity, you should retrieve it from the database using a Dynamic LINQ
. When the object is retrieved you could get the field value with the FieldValue<T>()
method and set a new value with the SetFieldValue<T>()
There aren't any known issues when using AutoInc KeyGenerator
with Artificial Types
For your convenience I have prepared a sample application which demonstrates How to: Read/Edit/Delete object of Artificial Type
, also the Id column of the table is using Identity mechanism. Please find the sample attached.
At the moment OpenAccess ORM
doesn't support compound keys for Artificial Types
. This feature request is in our backlog list and we will implement it for the next official release of OpenAccess - Q3 2013
, expected in the end of October.
I hope that helps.
OpenAccess ORM Q2 2013 brings you a more powerful code generation and a unique Bulk Operations support with LINQ syntax. Check out the list of new functionality and improvements shipped with this release.