3
votes

Im playing around with NHibernate 3 alpha but struggling to set up my SessionFactory.

I have the following:

 var config = new Configuration().Configure();
 _sessionFactory = config.BuildSessionFactory();

However, in the provided dlls with the 3 alpha download there are no provided proxy factory classes. Ie NHibernate.ByteCode.Castle, NHibernate.ByteCode.LinFu, and the Spring ones provided with nHib 2.x are not provided here.

So within the 3 alpha package, i looked at the NHibernate.Example.Web and used its provided NHibernate.ByteCode.LinFu; this example is using it within its config.hbm.

So, my hibernate.cfg.xml has

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

With the second line failing with of the above code failing when creating the Factory

NHibernate.Bytecode.UnableToLoadProxyFactoryFactoryException was unhandled by user code Message=Unable to load type 'NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu' during configuration of proxy factory class. Possible causes are: - The NHibernate.Bytecode provider assembly was not deployed. - The typeName used to initialize the 'proxyfactory.factory_class' property of the >session-factory section is not well formed

But, the LinFu ref is set to CopyLocal, and delving deeper into the stacktrace this gives:

at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet) InnerException: System.IO.FileLoadException
Message=Could not load file or assembly 'NHibernate, Version=3.0.0.1002, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) Source=mscorlib FileName=NHibernate, Version=3.0.0.1002, Culture=neutral, PublicKeyToken=null FusionLog==== Pre-bind state information ===

LOG: DisplayName = NHibernate, Version=3.0.0.1002, Culture=neutral, PublicKeyToken=null (Fully-specified)
LOG: Appbase = file:///C:/Dev/SilverTracker/src/SilverTracker/SilverTracker.Web.Services/
LOG: Initial PrivatePath = >C:\Dev\SilverTracker\src\SilverTracker\SilverTracker.Web.Services\bin
Calling assembly : NHibernate.ByteCode.LinFu, Version=3.0.0.1002, Culture=neutral, PublicKeyToken=null.

And the inner execption itself:

{"Could not load file or assembly 'NHibernate, Version=3.0.0.1002, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"NHibernate, Version=3.0.0.1002, Culture=neutral, PublicKeyToken=null"}

So as far as I can see its found the file, but its not compatable with the nHib 3 assembly.

So, im at a bit of a loss!

Has the config changed for 3? Im struggling to find any other examples bar the ones provided with the 3 assemblies.

This is a .NET 4.0 WCF service. Im aware I could just use 2.x but im trying out the new linq provider niceness.

Thanks in advance.

1

1 Answers

1
votes

If I wasnt such a numpty, I would have released there is a newer release (alpha 2) which includes everything you would expect.

Grabed from here: link text

All is well, i will leave this here incase anyone else has the same issue.