Dear all,
I am using FluentNhibernate in .Net 6. I want to do crud operations on mssql.
my code and the error is as below. the sam code is working with framework 4.8 but not working in .net 6
Error: could not create the driver from nhibernate.driver.sqlclientdriver, nhibernate, version=5.3.0.0, culture=neutral, publickeytoken=aa95f207798dfdb4
Code in .net 6 mvc project
public class DatabaseContext
{
private static ISessionFactory session;
private static ISessionFactory CreateSession()
{
const string connectionString = "Data source=HAFIZULLAH-OZGU\\SQLEXPRESS;Database=IHU_AcademicPerformance;Integrated Security=True";
if (session != null)
{
return session;
}
var sqlConfiguration = MsSqlConfiguration.MsSql2012.ConnectionString(connectionString);
return Fluently.Configure()
.Database(sqlConfiguration)
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<TokenMapping>())
.ExposeConfiguration(cfg => new SchemaExport(cfg).Execute(false, true, false))
.BuildSessionFactory();
}
public static NHibernate.ISession SessionOpen()
{
return CreateSession().OpenSession();
}
}
I will be happy for your valuable helpings.