This question is locked. New answers and comments are not allowed.
Hi,
We deside to works now with telerik OpenAccess. We use the version : 2009.3.1119.2
I read a couple of article about configuration, app.config, web.config, etc .... but i cannot found any information how to implement it correctly and my implementation don't work.
I need to communicate with 2 differents database.
I create so 2 projects class in VS2008, e.g.: with the name ORM1 and ORM2. I populate this projects with the Telerik OpenAccess Wizard.
I create also a repository project too manage the standard method and I include a ObjectScopeProviderORM1 and ORM1Provider class to manage the scope and db connection. Also here i have again a app.config!
Finally on my web project, i use the telerik wizard to enable this project to use OpenAccess.
I have i total 3 app.config and 1 web.config
My questions are:
- Is it really necessary to have so many config? How to force the app.config to use the connection string of the web.config (if the telerik wizard don't find the connection string on the app.config he don't work anymore)
-If I need to use all these config file, what is the best way?
1/ here is the code that i use for ORM1:
2/ The app.config for ORM2 have the same structure of ORM1 but with other definition for connectionStrings, etc...
3/ the app.config for my reposistory looks like this: (here i don't know who i can define a second mappgin, i found nothing about that).
4/ finally my web.config:
I use here the connection strings (or do I need also to define the tag <openaccess> ??)
I hoop there is a easy way to implement this??
Thanks in advance for your advice.
Edwin.
We deside to works now with telerik OpenAccess. We use the version : 2009.3.1119.2
I read a couple of article about configuration, app.config, web.config, etc .... but i cannot found any information how to implement it correctly and my implementation don't work.
I need to communicate with 2 differents database.
I create so 2 projects class in VS2008, e.g.: with the name ORM1 and ORM2. I populate this projects with the Telerik OpenAccess Wizard.
I create also a repository project too manage the standard method and I include a ObjectScopeProviderORM1 and ORM1Provider class to manage the scope and db connection. Also here i have again a app.config!
Finally on my web project, i use the telerik wizard to enable this project to use OpenAccess.
I have i total 3 app.config and 1 web.config
My questions are:
- Is it really necessary to have so many config? How to force the app.config to use the connection string of the web.config (if the telerik wizard don't find the connection string on the app.config he don't work anymore)
-If I need to use all these config file, what is the best way?
1/ here is the code that i use for ORM1:
<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 /> |
<backendconfigurations> |
<backendconfiguration id="mssqlConfigurationProject1" backend="mssql"> |
<mappingname>mssqlMapping</mappingname> |
</backendconfiguration> |
</backendconfigurations> |
<mappings current="mssqlMapping"> |
<mapping id="mssqlMapping"> |
<namespace name="MegaAndCo.ORM"> |
..... |
</mapping> |
</mappings> |
<connections> |
<connection id="ProjectConnection"> |
<connectionString>Data Source=Server;Initial Catalog=DBName;User ID=User;PasswordPassword=Password</connectionString> |
<backendconfigurationname>mssqlConfigurationProject1</backendconfigurationname> |
</connection> |
</connections> |
</openaccess> |
<connectionStrings> |
<add name="ProjectConnection" connectionString="data source=Server;initial catalog=DatabaseName;user id=UserName;password=Password" providerName="System.Data.SqlClient" /> |
</connectionStrings> |
</configuration> |
2/ The app.config for ORM2 have the same structure of ORM1 but with other definition for connectionStrings, etc...
3/ the app.config for my reposistory looks like this: (here i don't know who i can define a second mappgin, i found nothing about that).
<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> |
<reference assemblyname="XXX.ORM1" configrequired="True" /> |
<reference assemblyname="XXX.ORM2" configrequired="True" /> |
</references> |
<backendconfigurations> |
<backendconfiguration id="mssqlConfigurationProject1" backend="mssql"> |
<mappingname>mssqlMapping</mappingname> |
</backendconfiguration> |
<backendconfiguration id="mssqlConfigurationProject2" backend="mssql"> |
<mappingname>mssqlMapping2</mappingname> |
</backendconfiguration> |
</backendconfigurations> |
<mappings current="mssqlMapping"> |
<mapping id="mssqlMapping"> |
<namespace name="XXX.ORM1"> |
............... |
</namespace> |
</mapping> |
</mappings> |
</openaccess> |
</configuration> |
4/ finally my web.config:
I use here the connection strings (or do I need also to define the tag <openaccess> ??)
<connectionStrings> |
<clear /> |
<add name="ORM1" connectionString="data source=Server;database=DBNAME;user id=USER;password=PWD;application name=ORMCMS" providerName="System.Data.SqlClient" /> |
<add name="ORM2" connectionString="data source=Server;database=DBNAME;user id=USERNAME;password=PWD;application name=ORMCORE" providerName="System.Data.SqlClient" /> |
</connectionStrings> |
I hoop there is a easy way to implement this??
Thanks in advance for your advice.
Edwin.