In one of my applications, I request the active directory to get a list of all users below this user (using "Direct Reports"). Thus, basically, given the personβs name, he is viewed in AD, then direct reports are read. But then for each direct report, the tool must check direct reports of direct reports. Or, more abstractly: The tool will use the person as the root of the tree, and then go through the entire tree to get the names of all the leaves (maybe several hundred).
Now my concern is obviously performance, as it needs to be done quite a few times. My idea is to manually cache this (in essence, just put all the names in a long line and save it somewhere and update it once a day).
But I'm just wondering if there is a more elegant way to get the information first and then cache it, perhaps using something in the System.DirectoryServices namespace?
source share