Not sure where to start, but I had gotten the most recent version of NHibernate, successfully mapped the most simple of business objects, etc. When trying to move to FluentNHibernate and do the same thing, I got this error message on build:
“System.IO.FileLoadException: Could
not load file or assembly ‘NHibernate,
Version=2.1.0.4000, Culture=neutral,
PublicKeyToken=aa95f207798dfdb4’ or
one of its dependencies. The located
assembly’s manifest definition does
not match the assembly reference.”
Background: I’m new to Hibernate, NHibernate, and FluentNHibernate — but not to .NET, C#, etc.
Database
I have a database table called Category:
(PK) CategoryID (type: int), unique, auto-incrementing
UserID (type: uniqueidentifier) — given the value of the user Guid in ASP.NET database
Title (type: varchar(50) — the title of the category
Components involved:
- I have a SessionProviderClass which creates the mapping to the database
- I have a Category class which has all the virtual methods for FluentNHibernate to override
- I have a CategoryMap : ClassMap class, which does the fluent mappings for the entity
- I have a CategoryRepository class that contains the method to add & save the category
- I have the TestCatAdd.aspx file which uses the CategoryRepository class.
Would be happy to post code for any of those, but I’m not sure that it’s necessary, as I think the issue is that somewhere there’s a version conflict between what FluentNHibernate references and the NHibernate I have installed from before.
Thanks in advance for any help you can give!
There is no such thing as “Moving from NHibernate to FluentNHibernate”.
FluentNHibernate is just an addon for NHibernate that provides a slightly different way to create the mappings.
The error message is clear: you are using a version of FluentNHibernate compiled for NHibernate 2.1.0, and you tried to use it with NHibernate 2.1.2, hence the version conflict.
Either download a version of Fluent that uses NH 2.1.2 or compile from source.