Basic Connection Factory

The LdapConnectionFactory class is a basic factory that allows you to configure the creation of connections and create them. It will create a connection on demand and dispose any connection passed to ReleaseConnection. It is stand alone or one can be configured on LDAP Configuration.

// standalone
var connectionFactory = new ConnectionFactory("server:389");

var connection = connectionFactory.GetConnection();

// via LdapConfiguration

var connection = ldapConfiguration.ConnectionFactory.GetConnection();

Pooled Connection Factory

This connection factory can only be configured from the LDAP Configuration. The initial authentication bind is often the most expensive part of performing a query. Using a connection pool can reuse connections that have already been authenticated. This can be useful in environments that need to perform a large number of queries from different clients.

     .AuthenticateAs(new NetworkCredential("account", "password"));

Custom Factories

LDAP Configuration will allow you to associate a custom connection factory that implements ILdapConnectionFactory. The ConnectionFactoryBase class can simplify the process.

Last edited Jun 11, 2012 at 4:04 AM by MadHatter22, version 2