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


  <!-- Database and NHibernate Configuration -->

  <db:provider id="DbProvider"
                   provider="System.Data.SqlClient"
                   connectionString="Data Source=(local);Initial Catalog=Spring;Persist Security Info=True;User ID=springqa;Password=springqa;"/>



  <object id="SessionFactory" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate5">
    <property name="DbProvider" ref="DbProvider"/>
    <property name="MappingResources">
      <list>
        <value>assembly://Spring.Data.NHibernate5.Tests/Spring.Data.NHibernate/TestObject.hbm.xml</value>
      </list>
    </property>
    <property name="HibernateProperties">
      <dictionary>
        <entry key="hibernate.dialect"
               value="NHibernate.Dialect.MsSql2000Dialect"/>
             
        <entry key="hibernate.connection.driver_class"
               value="NHibernate.Driver.SqlClientDriver"/>

        <!--
             <entry key="proxyfactory.factory_class"
                    value="NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu"/>
             -->


      </dictionary>
    </property>

  </object>


  <object id="TestObjectDao" type="Spring.Data.NHibernate.TestObjectDao, Spring.Data.NHibernate5.Tests">
    <property name="SessionFactory" ref="SessionFactory"/>
  </object>

  <object id="transactionManager" type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate5">

    <property name="DbProvider" ref="DbProvider"/>
    <property name="sessionFactory" ref="SessionFactory"/>

  </object>


  <object name="SimpleService" type="Spring.Data.NHibernate.SimpleService, Spring.Data.NHibernate5.Tests">
    <property name="TestObjectDao" ref="TestObjectDao"/>
  </object>

  <object name="hibernateTemplate" type="Spring.Data.NHibernate.HibernateTemplate, Spring.Data.NHibernate5">
    <property name="sessionFactory" ref="SessionFactory"/>
  </object>
  
  <!-- once add 'internal' role for autoproxycreator that is created via the tx:attribute-driven element -->
  <!-- then we can add advisors to the config and have them picked up by any 'user' role defined autoproxycreators -->

  <object id="loggingAdvisor" type="Spring.Aop.Support.NameMatchMethodPointcutAdvisor, Spring.Aop">
    <property name="Advice">
      <object id="loggingAroundAdvice" type="Spring.Data.LoggingAroundAdvice, Spring.Data.Tests"/>
    </property>
    <property name="MappedNames">
      <list>
        <value>12341234asdf*</value>
      </list>
    </property>
  </object>

  <object id ="myAutoProxy" type="Spring.Aop.Framework.AutoProxy.ObjectNameAutoProxyCreator">

    <property name="InterceptorNames">
      <list>
        <value>loggingAdvisor</value>
      </list>
    </property>
    
    <property name="ProxyTargetType" value="false"/>
    <property name="ExposeProxy" value="false"/>
    <property name="Optimize" value="false"/>

    <property name="ObjectNames">
      <list>
        <value>TestObjectDao</value>
      </list>
    </property>
  </object>

 
  <tx:attribute-driven transaction-manager="transactionManager"/>


</objects>