CodeSmith Community
Your Code. Your Way. Faster!

Multiple Providers

Latest post 10-17-2008 12:11 PM by hugoforte. 3 replies.
  • 04-22-2006 8:59 AM

    • aboghani
    • Not Ranked
    • Joined on 03-31-2006
    • Posts 4
    • Points 140

    Multiple Providers

    Hello,

     

    I have two databases that I am trying to use. I generated both of them thru nettiers templates. I modified and here is my webconfig file.

    <configSections>

    <section name="netTiersService"
    type="TSC.DataAccessLayer.Bases.NetTiersServiceSection, TSC.DataAccessLayer"
    allowDefinition="MachineToApplication"
    restartOnExternalChanges="true" />

    <section name="netTiersService2"
    type="SFMembership.DataAccessLayer.Bases.NetTiersServiceSection, SFMembership.DataAccessLayer"
    allowDefinition="MachineToApplication"
    restartOnExternalChanges="true" />
    </
    configSections>

    <connectionStrings>
    <
    add name="netTiersConnectionString" connectionString="Data Source=ALYHOME\SQLEXPRESS;Initial Catalog=Test1;Integrated Security=true;Connection Timeout=1;" />
    <
    add name="netTiersConnectionString2" connectionString="Data Source=ALYHOME\SQLEXPRESS;Initial Catalog=DB1Test;Integrated Security=true;Connection Timeout=1;" />

    </connectionStrings>
    <
    netTiersService defaultProvider="SqlNetTiersProvider">

    <providers>

    <add
    name="SqlNetTiersProvider2"
    type="SFMembership.DataAccessLayer.SqlClient.SqlNetTiersProvider, SFMembership.DataAccessLayer.SqlClient"
    connectionStringName="netTiersConnectionString2"
    useStoredProcedure="false"
    providerInvariantName="System.Data.SqlClient"/>

    <add
    name="SqlNetTiersProvider"
    type="TSC.DataAccessLayer.SqlClient.SqlNetTiersProvider, TSC.DataAccessLayer.SqlClient"
    connectionStringName="netTiersConnectionString"
    useStoredProcedure="false"
    providerInvariantName="System.Data.SqlClient"/>
    </
    providers>
    </
    netTiersService>
    <
    appSettings/>

    I am getting the following error.

    Provider must implement the class 'TSC.DataAccessLayer.Bases.NetTiersProvider'.

    Any suggestions?

     

    • Post Points: 35
  • 04-22-2006 10:41 AM In reply to

    • bdiaz
    • Top 10 Contributor
    • Joined on 02-20-2006
    • Houston, TX
    • Posts 504
    • Points 15,290

    Re: Multiple Providers

    Reply |Contact |Answer
    You need to create a tag called "netTiersService2".  Try this...

    <configSections>
    <
    section name="netTiersService"
    type="TSC.DataAccessLayer.Bases.NetTiersServiceSection, TSC.DataAccessLayer"
    allowDefinition="MachineToApplication"
    restartOnExternalChanges="true" />

    <section name="netTiersService2"
    type="SFMembership.DataAccessLayer.Bases.NetTiersServiceSection, SFMembership.DataAccessLayer"
    allowDefinition="MachineToApplication"
    restartOnExternalChanges="true" />
    </
    configSections>

    <connectionStrings>
    <
    add name="netTiersConnectionString" connectionString="Data Source=ALYHOME\SQLEXPRESS;Initial Catalog=Test1;Integrated Security=true;Connection Timeout=1;" />
    <
    add name="netTiersConnectionString2" connectionString="Data Source=ALYHOME\SQLEXPRESS;Initial Catalog=DB1Test;Integrated Security=true;Connection Timeout=1;" />
    </
    connectionStrings>

    <netTiersService defaultProvider="SqlNetTiersProvider">
    <
    providers>
    <
    add
    name="SqlNetTiersProvider"
    type="TSC.DataAccessLayer.SqlClient.SqlNetTiersProvider, TSC.DataAccessLayer.SqlClient"
    connectionStringName="netTiersConnectionString"
    useStoredProcedure="false"
    providerInvariantName="System.Data.SqlClient"/>
    </
    providers>
    </
    netTiersService>

    <netTiersService2 defaultProvider="SqlNetTiersProvider2">
    <providers>
    <add
    name="SqlNetTiersProvider2"
    type="SFMembership.DataAccessLayer.SqlClient.SqlNetTiersProvider, SFMembership.DataAccessLayer.SqlClient"
    connectionStringName="netTiersConnectionString2"
    useStoredProcedure="false"
    providerInvariantName="System.Data.SqlClient"/>
    </providers>
    </netTiersService2>


    Regards,
    Bobby

    Bobby Diaz ------------------------------------------ Member of the .NetTiers team http://www.nettiers.com ------------------------------------------
    • Post Points: 35
  • 04-23-2006 4:30 AM In reply to

    Re: Multiple Providers

    Thanks abhogani & dbiaz for wonderful question & offcource wonderful answer... Thats solve my problem
    • Post Points: 35
  • 10-17-2008 12:11 PM In reply to

    • hugoforte
    • Not Ranked
    • Joined on 10-17-2008
    • Chicago
    • Posts 1
    • Points 5

    Re: Multiple Providers

    Reply |Contact |Answer

    In addition to modifying your web.config file as shown above you also need to edit the nettiers template file DataRepository.cst file under DataAccessLayer/

    Edit the following line:

    _section = WebConfigurationManager.GetSection("netTiersService") as NetTiersServiceSection;

    And change it to

    _section = WebConfigurationManager.GetSection("<insert your own section here") as NetTiersServiceSection;

     

    Cheers,

    Hugo

    • Post Points: 5
Page 1 of 1 (4 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems