private static ADObject GetCachedObject(string DN, string[] directoryAttributes, CmdletSessionInfo cmdletSessionInfo) { IDictionary <string, ADObject> protectedFromDeletionCache = ProtectedFromDeletionUtil.GetProtectedFromDeletionCache(cmdletSessionInfo); if (!protectedFromDeletionCache.ContainsKey(DN)) { protectedFromDeletionCache.Add(DN, Utils.GetDirectoryObject(DN, directoryAttributes, cmdletSessionInfo)); } return(protectedFromDeletionCache[DN]); }
private static void AddObjectToCache(ADObject directoryObj, CmdletSessionInfo cmdletSessionInfo) { IDictionary <string, ADObject> protectedFromDeletionCache = ProtectedFromDeletionUtil.GetProtectedFromDeletionCache(cmdletSessionInfo); protectedFromDeletionCache[directoryObj.DistinguishedName] = directoryObj; }