Results 1 to 2 of 2

Thread: DbProvider Configuration

Hybrid View

  1. #1
    Join Date
    Feb 2007
    Location
    New York
    Posts
    2

    Default DbProvider Configuration

    Sorry if I missed this in the documentation. How do I specify where the DatabaseConfigParser should pick up my DbProvider settings? Thanks in advance.


    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
    <configSections>
    <sectionGroup name='spring'>
    <section name='parsers'
    type='Spring.Context.Support.ConfigParsersSectionH andler, Spring.Core' />
    </sectionGroup>
    </configSections>

    <spring>

    <parsers>
    <parser namespace='http://www.springframework.net/database'
    type='Spring.Data.DatabaseConfigParser, Spring.Data'
    schemaLocation='assembly://Spring.Data/Spring.Data/spring-database.xsd' />
    </parsers>
    </spring>
    </configuration>

  2. #2
    Mark Pollack is offline Spring.NET Co-Lead Spring TeamSpring User
    Join Date
    Sep 2004
    Location
    New York, NY
    Posts
    1,683

    Default

    Hi,

    Take a look at Chapter 16 in the docs, it should help. The XML snip you listed is step 1 of the process, getting Spring.NET to recognize a custom schema for the database. The second step, is what you are looking for, specifying your provider settings. That is done with the following XML snip that is part of your Spring object definitions.

    Code:
    <objects xmlns='http://www.springframework.net'
             xmlns:d="http://www.springframework.net/database">
    
      <d:dbProvider id="DbProvider" 
                    provider="System.Data.SqlClient" 
                    connectionString="Data Source=(local);Database=Spring;User ID=springqa;Password=springqa;Trusted_Connection=False"/>
      
      <object id="adoTemplate" type="Spring.Data.AdoTemplate, Spring.Data">  
        <property name="DbProvider" ref="DbProvider"/>                
      </object>
    
    </objects>
    You can take a look at the Data Access QuickStart and/or the Transactions QuickStart for a working example.

    Cheers,
    Mark

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •