Using custom tables with OpenAccess
Hi,
I am writing a custom module, and i am basing it on the Jobs-Intermediate module example from the SDK. i want my implementation to work with custom tablesn in the sitefinity database, and not have the module auto generate them. Is this possible taking the example as it is? if not, what is the best way to do this, or is it simply just a case of switching our openAccess with say LinqQ??
Thanks,
Rob
can no one shed some light on this?
Hi Roberto Modica,
The OpenAccess ORM can map classes to database tables in two ways - forward and reverse. In Sitefinity, and the particular sample you are talking about, we use forward mapping. That just means that the database tables are generated by the ORM from the persistent classes.
You can also generate the persistent classes from the database tables (still using OpenAccess and not LINQtoSQL). However, we don't have a sample for this, and you will have to write your custom OpenAccess provider and use the reverse mapping mechanism in OpenAccess. The issues I can foresee with this approach are when you inherit from Content, which uses forward mapping.
We haven't tested this scenario with Sitefinity, but it should be achievable with some more custom code. Here is some documentation on how to use OpenAccess reverse mappings: http://www.telerik.com/help/openaccess-orm/openaccess-tasks-howto-reverse-mapping-wizard.html