Error loading scopes using multiple database connections

2 posts, 1 answers
  1. Frank Schürer
    Frank Schürer avatar
    13 posts
    Member since:
    Aug 2009

    Posted 23 Jun 2010 Link to this post

    Hi,

    i am new to Telerik ORM. I've tried setting up my first orm project with two database connections but i'm always getting an error message which refers to a resolving issue. This has surely to do with a configuration problem in my app.conigs. So, hope you can help me.

    Here's my code...


    app.config of GeoDataClasses
    <?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"
        <references /> 
        <connections> 
          <connection id="GeoDataConnection"
            <databasename>database1</databasename> 
            <servername>myserver</servername> 
            <integratedSecurity>True</integratedSecurity> 
            <backendconfigurationname>mssqlConfiguration</backendconfigurationname> 
          </connection> 
        </connections> 
        <backendconfigurations> 
          <backendconfiguration id="mssqlConfiguration" backend="mssql" driver="ntds"
            <mappingname>mssqlMapping</mappingname> 
            <databaseMapping> 
            </databaseMapping> 
          </backendconfiguration> 
        </backendconfigurations> 
        <mappings current="mssqlMapping"
          ...some field mappings 
        </mappings> 
      </openaccess> 
    </configuration> 


    app.config of MediaCenterClasses
    <?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"
        <references /> 
        <connections> 
          <connection id="MediaCenterConnection"
            <databasename>database2</databasename> 
            <servername>myserver</servername> 
            <integratedSecurity>True</integratedSecurity> 
            <backendconfigurationname>mssqlConfiguration</backendconfigurationname> 
          </connection> 
        </connections> 
        <backendconfigurations> 
          <backendconfiguration id="mssqlConfiguration" backend="mssql" driver="ntds"
            <mappingname>mssqlMapping</mappingname> 
            <databaseMapping> 
            </databaseMapping> 
          </backendconfiguration> 
        </backendconfigurations> 
        <mappings current="mssqlMapping"
        ...some field mappings 
        </mappings> 
      </openaccess> 
    </configuration> 

    app.config of my executable project
    <?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> 
      <system.diagnostics> 
        <sources> 
          <source name="DefaultSource" switchName="DefaultSwitch"
            <listeners> 
              <add name="FileLog" /> 
            </listeners> 
          </source> 
        </sources> 
        <switches> 
          <add name="DefaultSwitch" value="Information" /> 
        </switches> 
        <sharedListeners> 
          <add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter" /> 
        </sharedListeners> 
      </system.diagnostics> 
      <openaccess xmlns="http://www.telerik.com/OpenAccess"
        <connections> 
          <connection id="MediaCenterConnection"
            <databasename>database2</databasename> 
            <servername>myserver</servername> 
            <integratedSecurity>True</integratedSecurity> 
            <backendconfigurationname>mssqlConfiguration</backendconfigurationname> 
            <reference assemblyname="MediaCenterClasses" configrequired="True"
            </reference> 
          </connection> 
          <connection id="GeoDataConnection"
            <databasename>database1</databasename> 
            <servername>myserver</servername> 
            <integratedSecurity>True</integratedSecurity> 
            <backendconfigurationname>mssqlConfiguration</backendconfigurationname> 
            <reference assemblyname="GeoDataClasses" configrequired="True"
            </reference> 
          </connection> 
        </connections> 
        <backendconfigurations> 
          <backendconfiguration id="mssqlConfiguration" backend="mssql" driver="ntds"
            <mappingname>mssqlMapping</mappingname> 
          </backendconfiguration> 
        </backendconfigurations> 
        <mappings current="mssqlMapping"
          <mapping id="mssqlMapping" /> 
        </mappings> 
      </openaccess> 
    </configuration> 


    As soon as i load the scopes i get the following error message:

    The config file reference for assembly 'GeoDataClasses' could not be resolved. Make sure that the referencing assembly uses at least one class from the referenced assembly as otherwise the compiler won't generate a reference.

    Private Sub Load_Scope() 
            If m_scope_MediaCenter Is Nothing Then 
                m_scope_MediaCenter = Database.Get("MediaCenterConnection").GetObjectScope() 
            End If 
     
            If m_scope_GeoData Is Nothing Then 
                m_scope_GeoData = Database.Get("GeoDataConnection").GetObjectScope() 
            End If 
        End Sub 

    Any help would be really appreciated.
    Thanks.
  2. Answer
    Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 25 Jun 2010 Link to this post

    Hi Frank Schürer,

    I do not see a problem in your configuration. However, as the exception says, it is possible that you are not using in the executable project any of the classes from the GeoDataClasses assembly? In such cases the reference to the GeoDataClasses assembly is omitted and the configuration cannot be loaded. If this is the case, please make sure you are using at least one class from the model assembly. If it is not, let us know and we will investigate the issue further.

    Greetings,
    Alexander
    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
  3. DevCraft banner
Back to Top