5

I installed with NuGet the packages NHibernate and Castle.Core 3.0 for a new project. Usually we copied around the dlls manually; it is the first time I do that with NuGet.

Now I can't find out how to configure the ProxyFactoryFactory, or let's say, I can't find it. I referenced NHibernate and Castle.Core (the only dll I could find in the Castle.Core - package) within the project, and configured the following:

<property name="proxyfactory.factory_class">
    NHibernate.ByteCode.Castle.ProxyFactoryFactory, 
    NHibernate.ByteCode.Castle
</property>

This leads to:

Class Initialization method Tests.UnitTest1.MyClassInitialize threw exception.
NHibernate.Bytecode.UnableToLoadProxyFactoryFactoryException:
NHibernate.Bytecode.UnableToLoadProxyFactoryFactoryException: Unable
to load type 'NHibernate.ByteCode.Castle.ProxyFactoryFactory,
NHibernate.ByteCode.Castle' during configuration of proxy factory class.

Obviously this dll is missing, but where can I find that? There is a package in NuGet called Castle.DynamicProxy, but it is marked as obsolete.

p.s.: In the description of the Castle.Core 3.0 - package, it is said: ... including DynamicProxy ...

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
sl3dg3
  • 5,026
  • 12
  • 50
  • 74

1 Answers1

10

The last versions of NHibernate do not require configuring a proxy factory.

An internal one is used by default and the old adapters are not part of the project anymore.

Diego Mijelshon
  • 52,548
  • 16
  • 116
  • 154
  • In other words: I can leave away the configurations regarding the ProxyFactoryFactory? Do you know from what NHibernate-version this is true? – sl3dg3 Jan 23 '12 at 13:11
  • That is correct. I'm not sure about the starting version, but it's this way for 3.2. It will "just work" if you install from nuget. – Diego Mijelshon Jan 23 '12 at 13:47
  • I see - I had to downgrade to 3.1 because of fluent nhibernate. Maybe it is not included yet in this version, had to reference ProxyFactoryFactory... – sl3dg3 Jan 25 '12 at 10:04
  • 2
    That downgrade is not a good idea. You can always recompile FNH if their most current build is for an earlier NH version (shame on FNH; it has been out for 6 months) Or you can stop using it completely and move to the new NH mapping by code. – Diego Mijelshon Jan 25 '12 at 13:35
  • Oh... I didn't know about NH mapping by code! Darn... on the other hand, I really like FNH, it is very intuitive - can't imagine that NH mapping by code is better right now :) – sl3dg3 Jan 25 '12 at 17:12