More in this section

Forums / General Discussions / OpenAccess does not obey database table name in App.config?

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

2 posts, 1 answered
  1. bemara57
    bemara57 avatar
    135 posts
    Registered:
    27 Mar 2008
    02 Feb 2011
    Link to this post
    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.
  2. Nikolay Datchev
    Nikolay Datchev avatar
    87 posts
    Registered:
    01 Nov 2016
    02 Feb 2011
    Link to this post
    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
    Answered
2 posts, 1 answered