November Happy Hour will be moved to Thursday December 5th.

Class DirectoryDataFactory

Abstract ase class for specialized directory service adapters. The main purpose of these adapters is to return DirectoryData instances with information about specific entries in the directory service.

Inheritance
System.Object
DirectoryDataFactory
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Security
Assembly: EPiServer.dll
Version: 9.12.2
Syntax
public abstract class DirectoryDataFactory

Constructors

DirectoryDataFactory()

Declaration
protected DirectoryDataFactory()

Properties

RootDistinguishedName

Gets or sets the distinguished name of the root for directory service searches.

Declaration
public string RootDistinguishedName { get; protected set; }
Property Value
Type Description
System.String

The name of the root.

Methods

AddPropertyToLoad(String)

Adds a property to load on access to directory.

Declaration
public abstract void AddPropertyToLoad(string propertyName)
Parameters
Type Name Description
System.String propertyName

Name of the property.

Remarks

This class keeps a list of property names to query for whenever a directory entry is retrieved. By calling this method you can expand this list with custom properties.

FindAll(String, SearchScope)

Finds all directory entries that match the filter criteria.

Declaration
public ICollection<DirectoryData> FindAll(string filter, SearchScope scope)
Parameters
Type Name Description
System.String filter

The LDAP filter.

System.DirectoryServices.SearchScope scope

The scope to search.

Returns
Type Description
System.Collections.Generic.ICollection<DirectoryData>

A collection of DirectoryData items.

Remarks

This method simply delegates to the sorting implementation of FindAll with sortByProperty set to null.

FindAll(String, SearchScope, String)

Finds all directory entries that match the filter criteria.

Declaration
public abstract IList<DirectoryData> FindAll(string filter, SearchScope scope, string sortByProperty)
Parameters
Type Name Description
System.String filter

The LDAP filter.

System.DirectoryServices.SearchScope scope

The search scope.

System.String sortByProperty

The name of the property to sort directory entries by.

Returns
Type Description
System.Collections.Generic.IList<DirectoryData>

An IList of DirectoryData objects, sorted by the indicated property.

Remarks

If sortByProperty is set to null, the list will be returned without sorting.

FindOne(String, SearchScope)

Find one directory entry based on search filter.

Declaration
public abstract DirectoryData FindOne(string filter, SearchScope scope)
Parameters
Type Name Description
System.String filter

The filter, which is a LDAP query.

System.DirectoryServices.SearchScope scope

The scope at which to search.

Returns
Type Description
DirectoryData

A DirectoryData instance with the entry, or null if the search did not find an entry.

GetEntry(String)

Gets a specific directory entry as a DirectoryData object.

Declaration
public abstract DirectoryData GetEntry(string distinguishedName)
Parameters
Type Name Description
System.String distinguishedName

Distinguished name of the entry.

Returns
Type Description
DirectoryData

A DirectoryData instance containing the properties defined by PropertiesToLoad.

Initialize(NameValueCollection)

Initializes an instance of the DirectoryDataFactory class.

Declaration
public abstract void Initialize(NameValueCollection config)
Parameters
Type Name Description
System.Collections.Specialized.NameValueCollection config

The configuration data to use.

Remarks

This method is intended to be called from within a providers Initialize method. It will read its settings from the config parameter and initialize this instance. Required settings in config are: connectionStringName = name of the connection string to use for connecting to the Active Directory server. connectionUsername = username for the connection. connectionPassword = password for the connection.

Optional settings in config are: connectionProtection = level of protection and security for the Active Directory connection. None or Secure (default). cacheTimeout = how long cached Active Directory entries stys in the cache. Default is 10 minutes.

IsWithinSubtree(String)

Determines whether the specified distinguished name is part of the directory tree used for searches.

Declaration
public bool IsWithinSubtree(string distinguishedName)
Parameters
Type Name Description
System.String distinguishedName

Distinguished name of a directory service entry.

Returns
Type Description
System.Boolean

true if the specified distinguished name is within subtree; otherwise, false.

Extension Methods