Directory Context

The DirectoryContext class provides access to CRUD operations. You can create a DirectoryContext in the following ways:
From LdapConfiguration
If the configuration does not have a configured connection factory then an exception will be thrown.

using (var context = ldapConfiguration.CreateContext()) { ... }

OR

using (var context = new DirectoryContext(ldapConfiguration)) { ... }

Parameterless constructor
This will look for a configuration stored via UseStaticStorage in LdapConfiguration.Configuration. If one isn't found or it doesn't have a configured connection factory then an exception will be thrown.

using (var context = new DirectoryContext()) { ... }

From a LdapConnection with an optional configuration
If a configuration is not provided then a temporary one will be created (this includes a temporary DirectoryMapper).

var conn = new LdapConnection("server");

using (var context = new DirectoryContect(conn, true, config)) { ... }

Last edited Aug 3, 2013 at 7:36 AM by MadHatter22, version 3