<?xml version="1.0" encoding="utf-8" ?> 
<objects xmlns='http://www.springframework.net'
         xmlns:db="http://www.springframework.net/database">

    <db:provider id="DbProvider" 
                   provider="System.Data.SqlClient" 
                   connectionString="Data Source=MARKT60\SQL2005;Initial Catalog=CreditsAndDebits;User ID=springqa;Password=springqa"/>


    <object id="SessionFactory" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate20">
        <property name="DbProvider" ref="DbProvider"/>
        
      
        <property name="MappingAssemblies">
            <list>
                <value>Spring.Data.NHibernate20.Integration.Tests</value>
            </list>
        </property>
        <property name="HibernateProperties">
           <dictionary>

                <entry key="connection.provider"
                       value="NHibernate.Connection.DriverConnectionProvider"/>

                <entry key="dialect"
                       value="NHibernate.Dialect.MsSql2000Dialect"/>
                     
                <entry key="connection.driver_class"
                       value="NHibernate.Driver.SqlClientDriver"/>    
                                     
            </dictionary>
        </property>
                      
    </object>

    <object id="AccountCreditDao" type="Spring.Data.NHibernate.AccountCreditDao, Spring.Data.NHibernate20.Integration.Tests">
        <property name="SessionFactory" ref="SessionFactory"/>
    </object>
    <object id="AccountDebitDao" type="Spring.Data.NHibernate.AccountDebitDao, Spring.Data.NHibernate20.Integration.Tests">
        <property name="SessionFactory" ref="SessionFactory"/>
    </object>

    <object id="AuditDao" type="Spring.Data.NHibernate.AuditDao, Spring.Data.NHibernate20.Integration.Tests">
      <property name="DbProvider" ref="DbProvider"/>
    </object>


  <!-- The DAO object that performs multiple data access operations -->
    <object id="accountManagerTarget" 
            type="Spring.Data.NHibernate.AccountManager, Spring.Data.NHibernate20.Integration.Tests">
      <property name="AccountCreditDao" ref="AccountCreditDao"/>
      <property name="AccountDebitDao" ref="AccountDebitDao"/>
      
      <!--
      <property name="AuditDao" ref="AuditDao"/>
      -->
      
      
      <!--
      <property name="ThrowException" value="true"/>
      -->
      
      <!--
      <property name="ThrowExceptionAtEnd" value="true"/>
      -->
     
    </object> 
    
    <object id="hibernateTransactionManager" 
            type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate20">
        <!--  Comment out DbProvider if you want to have the tx mgr infer the DbProvider from
              the session factory.  -->
        <!--  Set the DbProvider explicitly if you would like to have ADO.NET and NHibernate 
              operations take place within the same transaction.  -->
        <property name="DbProvider" ref="DbProvider"/>
        <property name="sessionFactory" ref="SessionFactory"/>

    </object>
    
    <!-- construct the transaction proxy based on [Transaction()] in DAO class -->
    <!-- todo condense this xml for attribute usage for ease of use -->
    <!--
    <aop:transaction name=testObjectDao"
                     target="NHTestObjectDao"
                     interfaces="Spring.NHibernate.ITestObjectDao"
                     transactionManager="hibernateTransactionManager"/>
    -->
    
    <!-- Transactional Proxy for TestObjectManager using the ProxyFactoryObject -->
    <object id="accountManager" 
            type="Spring.Aop.Framework.ProxyFactoryObject, Spring.Aop">
        
        <property name="Target" ref="accountManagerTarget"/>

        <property name="InterceptorNames">
            <value>transactionInterceptor</value>
        </property>  
            
    </object>
    
    <!-- Transaction Interceptor based on attribute [Transaction()] -->
    <object id="transactionInterceptor" 
            type="Spring.Transaction.Interceptor.TransactionInterceptor, Spring.Data">
        <property name="TransactionManager" ref="hibernateTransactionManager"/>
        <!-- note do not have converter from string to this property type registered -->
        <property name="TransactionAttributeSource">
            <object type="Spring.Transaction.Interceptor.AttributesTransactionAttributeSource, Spring.Data"/>            
        </property>     
    </object>   
    
</objects>