This is a migrated thread and some comments may be shown as answers.

Error loading scopes using multiple database connections

1 Answer 141 Views
Getting Started
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Frank Schürer
Top achievements
Rank 1
Frank Schürer asked on 23 Jun 2010, 11:58 AM
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.

1 Answer, 1 is accepted

Sort by
0
Accepted
Alexander
Telerik team
answered on 25 Jun 2010, 09:04 AM
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
Tags
Getting Started
Asked by
Frank Schürer
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Share this question
or