1. We use OpenAccess code first method. How can we create triggers using this.
(Without doing it manually)
2. And also how can we create unique key from this code first method (what is the annotation).
Development team
1 Answer, 1 is accepted
0
Accepted
Zoran
Telerik team
answered on 29 Aug 2012, 03:48 PM
Hello Development Team,
OpenAccess can't generate custom triggers, nor unique key constraints on any column defined by the user. There is no metadata that can describe such database objects and they are not maintained. However, some backends require certain types of triggers in order to generate auto-incremented primary keys, like Oracle for example. If you would like to have a field marked as primary key, to generate a unique-key constraint and the according trigger so it inserts auto-incremented numbers calculated on the database server, this will automatically be done by OpenAccess, you just need to specify which is the identity field and to set Autoinc as the key generator for the entity. Other than this, custom triggers and unique keys can't be defined using any OpenAccess mapping, and should be manually added by the user after the database has been created.
All the best,
Zoran
the Telerik team
Follow @OpenAccessORM Twitter channel to be the first one to get the latest updates on new releases, tips and tricks and sneak peeks at our product labs!