Basic query by example using auto-mapping
using (LdapConnection connection = new LdapConnection("localhost"))
{
var example = new {DistinguishedName = "", Cn = ""};
using (var context = new DirectoryContext(connection))
{
context.Query(example,
"CN=Users,CN=Employees,DC=Northwind,DC=local")
.FirstOrDefault(u => u.Cn == "Alan Hatter");
}
}
using (LdapConnection connection = new LdapConnection("localhost"))
{
var example = new { DistinguishedName = "", Cn = "" };
using (var context = new DirectoryContext(connection))
{
context.Query(example,
"CN=Users,CN=Employees,DC=Northwind,DC=local")
.ToList();
}
}
No comments:
Post a Comment