OpenAccess does not obey database table name in App.config?

Posted by Community Admin on 03-Aug-2018 01:45

OpenAccess does not obey database table name in App.config?

All Replies

Posted by Community Admin on 02-Feb-2011 00:00

I am trying to copy the Products Module sample and tried using the naming convention of the database table in the App.config, but it seems to ignore what I put in there and always uses the model class name. Below is my App.config:

<?xml version="1.0"?>
<configuration>
    <configSections>
        <section name="openaccess" type="Telerik.OpenAccess.Config.ConfigSectionHandler, Telerik.OpenAccess.Config, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342" requirePermission="false"/>
    </configSections>
    <openaccess xmlns="http://www.telerik.com/OpenAccess">
        <connections>
            <connection id="DatabaseConnection1">
                <databasename>Sitefinity4</databasename>
                <servername>WIN-30EAUAH6HVM\SQLEXPRESS</servername>
                <integratedSecurity>True</integratedSecurity>
                <backendconfigurationname>mssqlConfiguration</backendconfigurationname>
            </connection>
        </connections>
        <backendconfigurations>
            <backendconfiguration id="mssqlConfiguration" backend="mssql">
                <mappingname>mssqlMapping</mappingname>
            </backendconfiguration>
        </backendconfigurations>
        <mappings current="mssqlMapping">
            <mapping id="mssqlMapping">
                <namespace name="MyNamespace.Modules.Mytest.Model">
                    <class name="MytestItem">
                        <extension key="db-table-name" value="sfex_mytest_item" />
                        <field name="permissions">
                            <collection>
                                <extension key="db-link-table" />
                            </collection>
                        </field>
                        <field name="urls">
                            <collection>
                                <extension key="inverse" value="parent" />
                                <extension key="managed" value="true" />
                            </collection>
                        </field>
                        <field name="permissionChildren">
                            <collection>
                                <extension key="db-link-table" />
                            </collection>
                        </field>
                    </class>
                    <class name="MytestItemUrlData">
                        <!--<extension key="db-table-name" value="sfex_mytest_urls" />-->
                        <field name="parent">
                            <extension key="db-ref" value="Telerik.Sitefinity.GenericContent.Model.Content.contentId">
                                <extension key="db-column">
                                    <extension key="db-column-name" value="content_id" />
                                </extension>
                            </extension>
                        </field>
                    </class>                   
                </namespace>
            </mapping>
        </mappings>
    </openaccess>
    <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
    </startup>
</configuration>


How come it is not obeying this: <extension key="db-table-name" value="sfex_mytest_item" />? It is creating the table as "mytest_item" instead.

Posted by Community Admin on 02-Feb-2011 00:00

Hi bemara57,

Is your app.config file an embedded resource. It might be the case that the config  is not considered at all if it is not embedded into the project. 

Kind regards,
Nikolay Datchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed