Logo

NHibernate

The object-relational mapper for .NET

NH2.1.0: Bytecode providers

This post is an update of “Reference to Castle removed”.

In the trunk we had removed all dependency from any kind of “Proxy framework” trough various implementations of IProxyFactoryFactory.

There is not a specific default Proxy-framework and now the set of proxyfactory.factory_class property, of the session-factory configuration section, is mandatory (as the property dialect).

So far, two implementations of IProxyFactoryFactory are available :

  1. NHibernate.ByteCode.LinFu.ProxyFactoryFactory
  2. NHibernate.ByteCode.Castle.ProxyFactoryFactory

Soon, we hope to have the availability of NHibernate.ByteCode.Spring.ProxyFactoryFactory.

For NHibernate testing purpose we are using LinFu without a special reason even if I have the impression that LinFu give us a very little performance improvement. For who are using NHibernate without an IoC framework LinFu.DynamicProxy is more than enough.

For who are working with Castle.ActiveRecord and/or Castle.Windsor, obviously, the best choice is Castle.DynamicProxy2 (mean NHibernate.ByteCode.Castle.ProxyFactoryFactory).

A minimal session-factory configuration, to work with NH using MsSQL and LinFu, should look like this one:

<hibernate-configuration  xmlns="urn:nhibernate-configuration-2.2" >
    <session-factory name="YourAppName">
        <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
        <property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
        <property name="connection.connection_string">
            Server=(local);initial catalog=nhibernate;Integrated Security=SSPI
        </property>
        <property name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
    </session-factory>
</hibernate-configuration>

In this case you must confirm that your deployment folder contains : NHibernate.ByteCode.LinFu.dll

 

The same configuration for who want use Castle should look like this one:

<hibernate-configuration  xmlns="urn:nhibernate-configuration-2.2" >
    <session-factory name="YourAppName">
        <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
        <property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
        <property name="connection.connection_string">
            Server=(local);initial catalog=nhibernate;Integrated Security=SSPI
        </property>
        <property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
    </session-factory>
</hibernate-configuration>

In this case you must confirm that your deployment folder contains : NHibernate.ByteCode.Castle.dll

 

LinFu info available here and code here.

 

Enjoy NHibernate injectability.

P.S. Let me say that something strange happened in my heart when I had remove the last reference to Castle in NH-Core and NH-Tests.


Posted Sun, 09 November 2008 05:04:00 AM by fabiomaulo
Filed under: proxy, NH2.1

comments powered by Disqus
© NHibernate Community 2024