NHibernate Forge
The official new home for the NHibernate for .NET community

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 nov 09 2008, 12:04 p.m. by Fabio Maulo
Filed under: ,

Comments

Tommaso Caldarola wrote re: NH2.1.0: Bytecode providers
on 11-10-2008 7:13

Wow, great feature.

Инъекция в разум wrote Байт-код провайдеры в NHibernate 2.1
on 12-04-2008 14:04

Один из авторов NHibernate Fabio Maulo сообщил в своем блоге, что на данный момент в trunk внесены изменения...

NHibernate blog wrote Entities behavior injection
on 12-12-2008 9:01

If you are working with NH you know that NH likes POCOs and you must have a default constructor without

Mindbloggling wrote How to get to use Linq to NHibernate
on 12-15-2008 18:24

For my startup project I have decided to use NHibernate as my ORM, and I wanted to use the new LINQ stuff

NHibernate blog wrote NHibernate with Spring.NET
on 03-03-2009 18:09

A new Dynamic-Proxy provider is available in NHibernate trunk ( here the others two) Erich Eichinger

NHibernate blog wrote NHibernate 2.1.0 on the road
on 03-15-2009 10:32

NHibernate 2.1.0.Alpha1 is released today. It is comparable to Hibernate 3.2.6 in terms of features.

jnoody wrote re: NH2.1.0: Bytecode providers
on 04-01-2009 17:47

Would you mind elaborating as to why one would want to change the underlying proxy implementation?  I'm not suggesting that it's not nice or even necessary. I am simply trying to understand of what benefit this is?  It was suggested in the dev google group that an example could be seen in NHibernate.ByteCode.Castle.Tests, but I still don't understand.  Thanks.

Fabio Maulo wrote re: NH2.1.0: Bytecode providers
on 04-01-2009 18:02

@jnoody

For us the benefit is remove a strong reference to a specific implementation of DynamicProxy, this is, may be, the only one benefit so far (note "so far").

Who use Castle as IoC, as a lot of NH users, have another benefit (Castle and NH now don't have a circular reference).

There are others benefit but to large to explain, if you want you can start a thread in the nh-user group.

jnoody wrote re: NH2.1.0: Bytecode providers
on 04-01-2009 18:24

Thanks Fabio.  Here's my post: groups.google.com/.../2f78857456bde8d6

Pat Gannon's blog wrote Getting ActiveRecord and NHibernate Working in Medium Trust
on 06-24-2009 2:31

Getting ActiveRecord and NHibernate Working in Medium Trust

AlbLog - Il blog di Alberto Dallagiacoma wrote Rilasciato NHibernate 2.1.0
on 07-20-2009 3:50

Rilasciato NHibernate 2.1.0

Yesterday's news wrote What's new in NHibernate 2.1
on 07-20-2009 20:44

What's new in NHibernate 2.1

Community Blogs wrote A total n00b’s guide to migrating from a custom data layer to Nhibernate: so many choices
on 08-20-2009 18:29

One of the great things about NHibernate is its vibrant community and ecosystem. So many people are using

YeanJay wrote 我的NHibernate曲折之行
on 09-24-2009 15:05
梅桦 wrote NHibernate初探(一)
on 11-06-2009 4:02

参见Lee的文章www.cnblogs.com/.../1323099.html

的第一个例子,一步步的跟着做,终于做出来一个。

Powered by Community Server (Commercial Edition), by Telligent Systems