I'm using Fluent NHibernate and using a connection provider in my 
configuration.

return Fluently.Configure()
                .Database(


                    
PostgreSQLConfiguration.PostgreSQL82.Provider<TenantConnectionProvider>()
                )
                
                .Mappings(cfg =>
                {
                    
cfg.FluentMappings.AddFromAssemblyOf<NHibernateSessionSource>();
                })
                .ExposeConfiguration(
                    c => {
                        c.DataBaseIntegration(prop =>
                        {
                            prop.BatchSize = 20;
                        });
                        
c.SetProperty(NHibernate.Cfg.Environment.SessionFactoryName, name);
                        
c.SetProperty(NHibernate.Cfg.Environment.GenerateStatistics, "true");

                    })
                .Diagnostics(x => x.Enable(true))
                .BuildConfiguration();
public class TenantConnectionProvider : DriverConnectionProvider
{
public override async Task<DbConnection> 
GetConnectionAsync(CancellationToken cancellation = default)
        {
// open connection async
}
public override DbConnection GetConnection()
        {
// open connection sync
}
}

I'm facing the following issues.


1.  NHibernate doesn't open the connection async using GetConnectionAsync() 
instead the connection is always open sync using the method GetConnection()
2. For each query that is executed a new connection is being opened. Can we 
use a single db connection per session?





-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fluent-nhibernate+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fluent-nhibernate/84d48859-6c63-4c76-9d84-22177fd58175%40googlegroups.com.

Reply via email to