-
Notifications
You must be signed in to change notification settings - Fork 932
Description
I'm moving from .Net Framework to Core 3.1
the below code works in .net framework but in Core i get an error.
The System.Data.SqlClient dll is in the bin folder and has PackageReference Include="Microsoft.Data.SqlClient" Version="2.0.0" in the project.
I'm not understanding what the issue is here.
Thoughts?
there is this message
HibernateException: The DbCommand and DbConnection implementation in the assembly System.Data.SqlClient could not be found. Ensure that the assembly System.Data.SqlClient is located in the application directory or in the Global Assembly Cache. If the assembly is in the GAC, use element in the application configuration file to specify the full name of the assembly.
The Error:
DatabaseInterfaces.DatabaseLibraryException
HResult=0x80131500
Message=: Could not create the driver from NHibernate.Driver.SqlClientDriver, NHibernate, Version=5.3.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4.
Source=NHibernateLibraries
StackTrace:
at NHibernateLibraries.NHibernateLibrarySession..ctor(String connectionString, String DomainAssemblyName) in C:\Users\Owner\Documents\GitHub\PathfinderControlLibrariesCore\NHibernateLibraries\NHibernateLibrarySession.cs:line 32
at NHibernateLibraries.NHibernateRepository`1..ctor(String connectionString, String domainAssemblyName) in C:\Users\Owner\Documents\GitHub\PathfinderControlLibrariesCore\NHibernateLibraries\NHibernateRepository.cs:line 21
at PathfinderContext.NHibernateServiceBase.FindBy[T](Int32 id) in
The Code:
private ISessionFactory CreateSessionFactory(string assemblyNameWithClassMapper)
{
var assembly = Assembly.Load(assemblyNameWithClassMapper);
if (assembly == null) throw new System.Exception(assemblyNameWithClassMapper + " referance is null");
var configuartion = Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2012.ConnectionString(_connectionString))
.Mappings(m => m.FluentMappings.AddFromAssembly(assembly));
return configuartion.BuildSessionFactory();
}