views:

38

answers:

0

I'm currently working in .NET 2.0 Visual Basic. The current project is an Active Directory Wrapper class library within which I have a Searcher(Of T) generic class that I wish to use to search the underlying directory for objects.

In this Searcher(Of T) class I have the following methods:

Private Function GetResults() As CustomSet(Of T)
Public Function ToList() As CustomSet(Of T)
Public Function Find(ByVal ParamArray filter() As Object) As CustomSet(Of T)
// And some other functions here...

The one that interests me the most is the Find() method to which I can pass property and values and would like to parse my LDAP query from this filter() ParamArray parameter. Actually, all I can figure out is this:

Public Sub SomeSub()
    Dim groupSearcher As Searcher(Of Group) = New Searcher(Of Group)()
    Dim groupsSet as CustomSet(Of Group) = groupSearcher.Find("Name=someName", "Description=someDescription")

    // Working with the result here...
End Sub

But what I want to be able to offer to my users is this:

Public Sub SomeSub()
    Dim groupSearcher As Searcher(Of Group) = New Searcher(Of Group)()
    Dim groupsSet As CustomSet(Of Groupe) = groupSearcher.Find(Name = "someName", Guid = someGuid, Description = "someDescription")

    // And work with the result here...
End Sub

In short, I want to offer some kind of Expression feature to my users, unless it is too much work, as this project is not the most important one and I don't have like 2 years to develop it. I think that the better thing I should do is to write something like CustomExpression that could be passed in parameters to some functions or subs.

Thanks for any suggestions that might bring me to my goal!