Ejemplo n.º 1
0
        /// <inheritdoc />
        public IConnectionAccess GetConnectionAccess(TenantConfiguration tenantConfiguration, ISessionFactoryImplementor sessionFactory)
        {
            var tenantConnectionString = GetTenantConnectionString(tenantConfiguration, sessionFactory);

            if (string.IsNullOrEmpty(tenantConnectionString))
            {
                throw new HibernateException($"Tenant '{tenantConfiguration.TenantIdentifier}' connection string is empty.");
            }

            return(new ContextualConnectionAccess(tenantConnectionString, sessionFactory));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Gets the connection string for the given tenant configuration.
 /// </summary>
 /// <param name="tenantConfiguration">The tenant configuration.</param>
 /// <param name="sessionFactory">The session factory.</param>
 /// <returns>The connection string for the tenant.</returns>
 protected abstract string GetTenantConnectionString(TenantConfiguration tenantConfiguration, ISessionFactoryImplementor sessionFactory);