-
Notifications
You must be signed in to change notification settings - Fork 684
Description
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;
}
}
}
}