I need to access data from pre-existing tables. I’ve started working my way through creating a module to display the data etc. However, Orchard is prefixing the table commands with the ‘Table_Prefix’ and ‘Module Name’.
Is there any way I can specify what table to bind the model, so that I can use the existing IRepository
I’m trying to steer clear of modifying the core code, or implement my own IRepository ( which I’ve got a feeling is what I’m going to have to do.)
Thanks in advance.
You can create custom table naming convention (so that it would fit your current naming) by altering the core code, in three ways:
BuildRecordmethod ofCompositionStrategyclass(Orchard.Framework/Environment/ShellBuilders/CompositionStrategy), so you can simply modify the code here.
Applymethod ofOrchard.Data.Conventions.RecordTableNameConventionclass. This is where the record table name mappings (built in point 1.) get pushed to NHibernate.FluentNHibernate.Conventions.IClassConvention(similar toRecordTableNameConventionmentioned above and replace the default one used byAutoMapinOrchard.Data.Providers.AbstractDataServicesProvider‘sCreatePersistenceModel(...)method with it.You could also create your own
IDataServicesProviderimplementation, but that would surely be an overkill if you only need to change the table naming convention.