Method or operation is not implemented.

Feb 8, 2008 at 4:19 PM
Hi. First, off, this is such a good idea. I am evaluating using this as a basis for an upcoming project where I need to synchronize a database of users into an Active Directory. Things were going great, until I wrote the following chunk of code:


var dbUsers = new DirectorySource<MyUser>(rootEntry, SearchScope.Subtree);
var dbResults = (from u in dbUsers where u.EmployeeID == employeeId select u).SingleOrDefault();
if (dbResults != null) {
result = dbResults;
}

The problem is an Method or operation is not implemented exception is thrown when executing this line of code:

var dbResults = (from u in dbUsers where u.EmployeeID == employeeId select u).SingleOrDefault();

Looks like the method hasn't been implemented for:

public TResult Execute<TResult>(Expression expression)
{
throw new NotImplementedException();
}

Line 248 in the DirectorySource.cs file. Any plans for an update that might have this...I guess I could take a stab at it myself, if I can find the time.
Or is there something wrong I am doing in the code? Basically, I just want to get a DirectoryEntry for a user with a specific value in the employeeID attribute.
Coordinator
Feb 28, 2008 at 8:36 PM
Hi msr79,

I'll take a look into this - for singleton results the Execute method is used by the Queryable methods indeed. Question is how to map this efficiently on querying code so that we only retrieve that one item instead of a bunch of items applying client-side filtering.

In the meantime you can inject AsEnumerable():

(from u in dbUsers where u.EmployeeID == employeeId select u).AsEnumerable().SingleOrDefault();

Thanks,
-Bart
Mar 5, 2008 at 5:56 PM
Thanks Bart! I'll try that as a work around and see how it goes. Good job on this project thus far. I am liking it a lot.