<?xml version="1.0" encoding="utf-8" ?>
<objects xmlns="http://www.springframework.net"
         xmlns:db="http://www.springframework.net/database">
  <!-- Referenced by main application context configuration file. Conversation especific. -->
  <description>
    The Northwind object definitions for the Data Access Objects.
  </description>

  <!-- Property placeholder configurer for database settings -->
  <object type="Spring.Objects.Factory.Config.PropertyPlaceholderConfigurer, Spring.Core">
    <property name="ConfigSections" value="databaseSettings"/>
  </object>

  <!-- Database Configuration -->
  <db:provider id="DbProvider"
                   provider="SQLite-1.0.65"
                   connectionString="Data Source=|DataDirectory|Northwind.db;Version=3;FailIfMissing=True;"/>

  <!-- NHibernate Configuration -->
  <object id="NHibernateSessionFactory" type="Spring.Northwind.Dao.NHibernate.CustomLocalSessionFactoryObject, Spring.Northwind.Dao.NHibernate">
    <property name="DbProvider" ref="DbProvider"/>
    <property name="MappingAssemblies">
      <list>
        <value>Spring.Northwind.Dao.NHibernate</value>
      </list>
    </property>
    <property name="HibernateProperties">
      <dictionary>
        <entry key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider"/>
        <entry key="dialect" value="NHibernate.Dialect.SQLiteDialect"/>
        <entry key="connection.driver_class" value="NHibernate.Driver.SQLite20Driver"/>
        <entry key="use_proxy_validator" value="false" />
        <entry key="show_sql" value="false"/>
        <entry key="format_sql" value="true"/>
        <entry key="connection.release_mode" value="on_close"/>
      </dictionary>
    </property>

    <!-- provides integation with Spring's declarative transaction management features -->
    <property name="ExposeTransactionAwareSessionFactory" value="true" />

  </object>

  <!-- Transaction Management Strategy - local database transactions -->
  <object id="transactionManager"
        type="Spring.Data.NHibernate.HibernateTransactionManager, Spring.Data.NHibernate5">

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

  </object>

  <!-- Exception translation object post processor -->
  <object type="Spring.Dao.Attributes.PersistenceExceptionTranslationPostProcessor, Spring.Data"/>

  <!-- Data Access Objects -->
  <object id="CustomerDao" type="Spring.Northwind.Dao.NHibernate.HibernateCustomerDao, Spring.Northwind.Dao.NHibernate">
    <property name="SessionFactory" ref="NHibernateSessionFactory"/>
  </object>

  <object id="OrderDao" type="Spring.Northwind.Dao.NHibernate.HibernateOrderDao, Spring.Northwind.Dao.NHibernate">
    <property name="SessionFactory" ref="NHibernateSessionFactory"/>
  </object>

  <object id="CustomerClassificationCalculator" type="Spring.Northwind.Domain.DefaultCustomerClassificationCalculator, Spring.Northwind.Dao">
    
  </object>

  <object id="CustomerEntityProtoType" type="Spring.Northwind.Domain.Customer, Spring.Northwind.Dao" singleton="false">
    <constructor-arg ref="CustomerClassificationCalculator" />
  </object>


</objects>
