Skip to content

Latest commit

 

History

History
62 lines (52 loc) · 2.71 KB

readme.md

File metadata and controls

62 lines (52 loc) · 2.71 KB

LINQ2LDAP MIT License Build status codecov Code of Conduct

Linq2Ldap.*

This is a thin wrapper library for System.DirectoryServices.* that facilitates using LINQ Expressions to represent LDAP filters. It uses Linq2Ldap.Core to compile and parse LDAP filters.

Here is an example that takes an Expression provides a page of results.

System.DirectoryServices.Protocols Example

public virtual IEnumerable<T> PageWithVLV<T>(
    Expression<Func<T, bool>> filter,
    int offsetPage = 0, int pageSize = 10,
    SortKey[] sortKeys = null
)
    where T : IEntry, new()
{
    var search = new LinqSearchRequest<T>(DistinguishedName, filter, Scope);
    var pageControl = new VlvRequestControl(0, pageSize - 1, pageSize * offsetPage + 1);
    var soc = new SearchOptionsControl(SearchOption.DomainScope);
    search.Controls.Add(pageControl);
    search.Controls.Add(soc);
    if (sortKeys != null)
    {
        var sortControl = new SortRequestControl(sortKeys);
        search.Controls.Add(sortControl);
    }
    return Connection.SendRequest(search).Entries;
}

Please note that even though the System.DirectoryServices.* libraries aren't compatible with Mac/Linux, you can still use Linq2Ldap.Core with a non-Windows LDAP library.

For more information, please visit the Wiki.

Contributing

Coin Address
Ethereum 0xfCdA80Be00F8907FfcD227683D9D96f7C47eC67f
Bitcoin 33pypS6oRmgmvMwAnX5rpJAaxnqScxSALS