Update #42: AD Migration

Refactor to target specific Domain Controllers, with failover.
This commit is contained in:
Gary Sharp
2014-04-21 21:43:13 +10:00
parent 43fc622121
commit 09c2a24222
98 changed files with 3808 additions and 3271 deletions
@@ -0,0 +1,53 @@
using System.Collections.Generic;
using System.DirectoryServices;
using System.Linq;
namespace Disco.Services.Interop.ActiveDirectory
{
public class ADSearchResult
{
private SearchResult _result;
public ADDomain Domain { get; private set; }
public ADDomainController DomainController { get; private set; }
public string SearchPath { get; private set; }
public string LdapFilter { get; private set; }
public string LdapPath { get; private set; }
public string DistinguishedName { get; private set; }
public ADSearchResult(ADDomain Domain, ADDomainController DomainController, string SearchPath, string LdapFilter, SearchResult Result)
{
this._result = Result;
this.Domain = Domain;
this.DomainController = DomainController;
this.SearchPath = SearchPath;
this.LdapFilter = LdapFilter;
this.LdapPath = _result.Path;
this.DistinguishedName = Value<string>("dn");
}
public bool Contains(string PropertyName)
{
return _result.Properties.Contains(PropertyName);
}
public T Value<T>(string PropertyName)
{
var p = Values<T>(PropertyName);
return p.FirstOrDefault();
}
public IEnumerable<T> Values<T>(string PropertyName)
{
var p = _result.Properties[PropertyName];
return p.OfType<T>();
}
public override string ToString()
{
return this.LdapPath;
}
}
}