Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WF / Activities / Role / DirectoryLocalQuery.cs / 1305376 / DirectoryLocalQuery.cs
#region Using directives using System; using System.Collections.Generic; using System.Text; using System.DirectoryServices; #endregion namespace System.Workflow.Activities { [Serializable] sealed internal class DirectoryLocalQuery : IDirectoryOperation { internal String m_name; internal String m_value; internal DirectoryQueryOperation m_operation; public DirectoryLocalQuery(String name, String value, DirectoryQueryOperation operation) { if (name == null) throw new ArgumentNullException("name"); if (value == null) throw new ArgumentNullException("value"); this.m_name = name; this.m_value = value; this.m_operation = operation; } public void GetResult(DirectoryEntry rootEntry, DirectoryEntry currentEntry, Listresponse) { if (rootEntry == null) throw new ArgumentNullException("rootEntry"); if (currentEntry == null) throw new ArgumentNullException("currentEntry"); if (response == null) throw new ArgumentNullException("response"); using (DirectorySearcher searcher = new DirectorySearcher(currentEntry)) { String strStart = "("; String strOperation = ""; String strEnd = ")"; switch (this.m_operation) { case DirectoryQueryOperation.Equal: strOperation = "="; break; case DirectoryQueryOperation.NotEqual: strStart = "(!("; strOperation = "="; strEnd = "))"; break; default: System.Diagnostics.Debug.Assert(false); break; } searcher.Filter = strStart + this.m_name + strOperation + this.m_value + strEnd; foreach (SearchResult result in searcher.FindAll()) { response.Add(result.GetDirectoryEntry()); } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. #region Using directives using System; using System.Collections.Generic; using System.Text; using System.DirectoryServices; #endregion namespace System.Workflow.Activities { [Serializable] sealed internal class DirectoryLocalQuery : IDirectoryOperation { internal String m_name; internal String m_value; internal DirectoryQueryOperation m_operation; public DirectoryLocalQuery(String name, String value, DirectoryQueryOperation operation) { if (name == null) throw new ArgumentNullException("name"); if (value == null) throw new ArgumentNullException("value"); this.m_name = name; this.m_value = value; this.m_operation = operation; } public void GetResult(DirectoryEntry rootEntry, DirectoryEntry currentEntry, List response) { if (rootEntry == null) throw new ArgumentNullException("rootEntry"); if (currentEntry == null) throw new ArgumentNullException("currentEntry"); if (response == null) throw new ArgumentNullException("response"); using (DirectorySearcher searcher = new DirectorySearcher(currentEntry)) { String strStart = "("; String strOperation = ""; String strEnd = ")"; switch (this.m_operation) { case DirectoryQueryOperation.Equal: strOperation = "="; break; case DirectoryQueryOperation.NotEqual: strStart = "(!("; strOperation = "="; strEnd = "))"; break; default: System.Diagnostics.Debug.Assert(false); break; } searcher.Filter = strStart + this.m_name + strOperation + this.m_value + strEnd; foreach (SearchResult result in searcher.FindAll()) { response.Add(result.GetDirectoryEntry()); } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- NullableDecimalAverageAggregationOperator.cs
- SqlCacheDependencySection.cs
- RegexInterpreter.cs
- safelink.cs
- WebPartConnectionsDisconnectVerb.cs
- DocumentScope.cs
- HttpResponseHeader.cs
- JpegBitmapEncoder.cs
- BaseTemplateBuildProvider.cs
- HttpProcessUtility.cs
- Link.cs
- SvcMapFileSerializer.cs
- CompleteWizardStep.cs
- SharedPersonalizationStateInfo.cs
- _LoggingObject.cs
- BuildProviderAppliesToAttribute.cs
- BStrWrapper.cs
- DoubleAnimationUsingKeyFrames.cs
- Module.cs
- FontResourceCache.cs
- HtmlInputPassword.cs
- FixedHyperLink.cs
- AutomationPatternInfo.cs
- UnicodeEncoding.cs
- altserialization.cs
- XmlSchemaSimpleContentExtension.cs
- SqlReorderer.cs
- TableCell.cs
- BooleanProjectedSlot.cs
- WorkItem.cs
- ObjRef.cs
- ObjectDataSourceFilteringEventArgs.cs
- ProfileParameter.cs
- XmlNamespaceDeclarationsAttribute.cs
- DataSourceHelper.cs
- ResourceReferenceExpression.cs
- NamespaceDisplayAutomationPeer.cs
- Binding.cs
- XmlSchemaIdentityConstraint.cs
- X500Name.cs
- EditingScope.cs
- ToolStripDropDownClosedEventArgs.cs
- ButtonFieldBase.cs
- Mapping.cs
- CalendarKeyboardHelper.cs
- MissingMemberException.cs
- BufferBuilder.cs
- XmlNodeChangedEventArgs.cs
- Relationship.cs
- MatrixIndependentAnimationStorage.cs
- EnumConverter.cs
- DrawingContext.cs
- ComplexBindingPropertiesAttribute.cs
- ApplyImportsAction.cs
- XPathSelectionIterator.cs
- PropertyChangedEventArgs.cs
- Material.cs
- BufferModesCollection.cs
- DuplicateWaitObjectException.cs
- PropertyBuilder.cs
- PathData.cs
- CrossAppDomainChannel.cs
- DiagnosticStrings.cs
- BufferedReadStream.cs
- SignatureGenerator.cs
- EventManager.cs
- DependencyObjectType.cs
- XmlILAnnotation.cs
- ResolvePPIDRequest.cs
- AdRotatorDesigner.cs
- RequiredFieldValidator.cs
- SelectionGlyphBase.cs
- baseaxisquery.cs
- DataPagerCommandEventArgs.cs
- NodeLabelEditEvent.cs
- ICspAsymmetricAlgorithm.cs
- StyleCollection.cs
- ActivityBindForm.cs
- HighContrastHelper.cs
- AbsoluteQuery.cs
- CacheMode.cs
- WizardForm.cs
- MembershipPasswordException.cs
- NameValuePair.cs
- GridViewRowPresenterBase.cs
- DbProviderFactory.cs
- Interlocked.cs
- EntityTemplateFactory.cs
- FolderBrowserDialog.cs
- ExternalCalls.cs
- SafeSecurityHelper.cs
- TimersDescriptionAttribute.cs
- FixedSOMSemanticBox.cs
- DataObjectPastingEventArgs.cs
- ContentTextAutomationPeer.cs
- StrokeNodeOperations.cs
- TraceSource.cs
- EntitySetBase.cs
- FusionWrap.cs
- MouseActionValueSerializer.cs