Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 2.1.2 don't work with NHibernate 5.2.4 #430

Closed
masyaf opened this issue Mar 13, 2019 · 7 comments
Closed

Version 2.1.2 don't work with NHibernate 5.2.4 #430

masyaf opened this issue Mar 13, 2019 · 7 comments

Comments

@masyaf
Copy link

masyaf commented Mar 13, 2019

FluentNHibernate 2.1.2
NHibernate 5.2.4

FluentNHibernate does not work with a version of NHibernate

When you run an application and perform the insert procedure

An application throws an exception;

System.Exception: 'Can not make the file or assembly' NHibernate, Version = 5.1.0.0, Culture = neutral, PublicKeyToken = aa95f207798dfdb4 'or one of its dependencies. An assembly definition is not a reference to the assembly. (Exception from HRESULT: 0x80131040) '

Exception thrown: 'System.IO.FileLoadException' in InterCert.Infrastructure.Repository.dll
Exception posted: 'System.TypeInitializationException' in InterCert.Infrastructure.Repository.dll
Exception thrown: 'System.Exception' in InterCert.Model.Negocio.dll
An unhandled exception of type 'System.Exception' occurred in InterCert.Model.Negocio.dll
Can not load the file or assembly 'NHibernate, Version = 5.1.0.0, Culture = neutral, PublicKeyToken = aa95f207798dfdb4' or one of its dependencies. An assembly definition is not a reference to the assembly. (Exception from HRESULT: 0x80131040)

My SessionProvider

using System;
using FluentNHibernate.Cfg;
using FluentNHibernate.Cfg.Db;
using InterCert.Modelo.Entitdades;
using NHibernate;
using NHibernate.Tool.hbm2ddl;

namespace InterCert.Infraestrutura.Repositorio.NHibernate.Helpers
{
    internal class SessionProvider
    {
        private static ISessionFactory `_sessionFactory;`

        static SessionProvider()
        {

            _sessionFactory = Fluently.Configure()
              .Database(MsSqlConfiguration.MsSql2008
                .ConnectionString(c => c
                  .FromConnectionStringWithKey(InterCertGlobal.CONN_STRING))
                .ShowSql())
              .Mappings(m => m
                .FluentMappings.AddFromAssemblyOf<Estoque>())
               .ExposeConfiguration(cfg => new SchemaExport(cfg).Execute(true, true, false))
              .BuildSessionFactory();



        }

        public static ISessionFactory SessionFactory
        {
            get
            {
                return _sessionFactory;
            }
        }
    }
}



@kpinette
Copy link

I'm experiencing the same issue when trying to install a windows service that references FluentNHibernate 2.1.2. I have NHibernate 5.2.5 but it's looking for 5.1.0.0 even with a binding redirect set in my app.config. Is anyone planning on addressing this?

@danilobreda
Copy link
Contributor

#429

@Gener4tor
Copy link

Ive got the same problem. Does anyone has a workaround for this?

@kpinette
Copy link

kpinette commented Oct 16, 2019

@Gener4tor I had to downgrade to NHibernate 5.1.5. Hasn't been an issue, but we don't use NH heavily in this project. I'd have concerns with some of our others.

@Gener4tor
Copy link

Gener4tor commented Oct 17, 2019

@kpinette: Thanks. Downgrading to NHibernate 5.1.5 worked for me too...as did 5.1.6

@octocat-mona
Copy link

@kpinette A binding redirect does work for me:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" />
        <bindingRedirect oldVersion="5.1.0.0" newVersion="5.2.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

@hazzik
Copy link
Member

hazzik commented Sep 18, 2020

Updated to 5.2.7 in #453

@hazzik hazzik closed this as completed Sep 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants