Documentation queries - Mapping page - Closed

Dec 18, 2011 at 7:39 AM

Regarding your Mapping page...

I'm reading your documentation linearly so the answer to this may become clear, later, but it would help if it was clear here: are your searches OneLevel or Subtree?  In other words, are you treating an OU as a table, or an OU and all sub OUs as a table?  In your example, will a query on Server find www.example.com? 

Also, it's not clear how this would work with a delegated admin model where you might have top-level OUs of Division1, Division2, Division3, each with OUs of Users, Computers and Groups, when you want to query all users.  Or when it's even more messy, as ours is.

Coordinator
Dec 19, 2011 at 2:38 AM
Edited Dec 19, 2011 at 11:54 PM

I was trying to explain the way naming contexts work in a directory vs. RDBMS.  I'll try to come up with a better example in the future (unless you already know of a better one).  Yes, a query for Server will find www.example.com assuming you use Subtree.  All queries default to Subtree, but you can pass in a specific SearchScope if necessary.  Here's an example:

 

using (var context = new DirectoryContext())
{
     List<Server> servers = context
          .Query<Server>(SearchScope.Subtree)
          .ToList();
}

 

Your second concern seems similar to what sah302 was trying to accomplish here: http://linqtoldap.codeplex.com/discussions/279887.  I apologize for my lack of knowledge on the subject.  I'm unfamiliar with designing directory trees (more experience with RDBMS).  You could map your objects to the highest level and filter by object category / object class and division.  You could also do something similar to what sah302 did and change the naming context depending on the user.

Please let me know if this helps at all.

Dec 20, 2011 at 6:18 AM
Edited Jan 27, 2012 at 8:17 PM

Thanks for the reply.  I forgot to thank you for this project: when I discovered it, it felt like Christmas come early!

I'll start by setting the naming contexts to be the defaultNamingContext and see how I get on: I think most of my searches will be for individual objects or very small sets and use indexed attributes so I'm not too worried about performance.

I've been using Class Maps, so far, in my experiments because the first scenario I'd like to use this in is a WCF RIA service - I think I'll have to use POCOs so I can add attributes required by RIA services which, I guess, means they won't be POCOs anymore but you see what I mean.

****** EDIT ******

See this discussion topic for the ramifications of using defaultNamingContext.