Trying to establish session factory on Microsoft.Data.Sqlite with fluent nhibernate. All references are added and are available in the bin folder on runtime.
var sessionFactory = Fluently.Configure()
.Database(MsSqliteConfiguration.Standard.UsingFile(DbFilePath))
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<CheckExe>())
.ExposeConfiguration(BuildSchema)
.BuildSessionFactory();
This method throws exception as "The requested collection 'DataTypes' is not defined."
Tried adding the driver and dialect in the configuration NHibernate.Driver.MicrosoftDataSqlClientDriver and NHibernate.Dialect.SQLiteDialect both through config xml and through c# code set property . But, facing another blocker error as follows.
var cfg = new Configuration();
cfg.SetProperty("connection.connection_string", ConnectionString);
cfg.SetProperty("dialect", typeof(global::NHibernate.Dialect.SQLiteDialect).AssemblyQualifiedName);
cfg.SetProperty("connection.driver_class", typeof(global::NHibernate.Driver.MicrosoftDataSqlClientDriver).AssemblyQualifiedName);
Fluently.Configure(cfg).Mappings(m => m.FluentMappings.AddFromAssemblyOf<CheckExe>()).BuildSessionFactory();
Could not create the driver from NHibernate.Driver.MicrosoftDataSqlClientDriver, NHibernate, Version=5.4.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4.
Tried this way too - resulted in same error
return Fluently.Configure()
.Database(MsSqliteConfiguration.Standard.UsingFile(DbFilePath).Driver<MicrosoftDataSqlClientDriver>().Dialect<SQLiteDialect>())
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<CheckExe>())
.ExposeConfiguration(BuildSchema)
.BuildSessionFactory();
This worked for me and the exception got resolved; however if we try to create the session factory again then another exception occurs:
With or without any schema update - this occurs whenever a schema update is called.
Also, the same works fine with
System.Data.Sqlite, withMicrosoft.Data.Sqlitethe exception occurs.