开发者

Moving from NHibernate to FluentNHibernate: assembly error (related to versions)?

开发者 https://www.devze.com 2022-12-31 11:02 出处:网络
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 t

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 versi开发者_运维问答on 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.


Thanks all,

The true answer was to remove and re-add the assemblies that came with FluentNHibernate (including the compatible version of NHibernate).

I also had to remember to add the correct references (for example, when using NHibernate, I had not added references to Castle.dll, etc.)

However, this uncovered more problems, which I'll post about in a separate thread.

Thanks!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号