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
- FixedPageProcessor.cs
- AppDomainResourcePerfCounters.cs
- SoapExtensionReflector.cs
- parserscommon.cs
- XPathDocumentBuilder.cs
- ResourceContainer.cs
- ObjectStateFormatter.cs
- CollectionViewProxy.cs
- LineServices.cs
- SafeFileHandle.cs
- LineBreakRecord.cs
- StorageFunctionMapping.cs
- MarshalByValueComponent.cs
- StylusDevice.cs
- AlphabeticalEnumConverter.cs
- TextEditor.cs
- PropertyChangedEventManager.cs
- TreeViewItemAutomationPeer.cs
- XmlHierarchyData.cs
- HttpValueCollection.cs
- ControlCollection.cs
- XmlDocumentType.cs
- OdbcConnectionOpen.cs
- MenuItemBinding.cs
- SmtpLoginAuthenticationModule.cs
- ErrorHandler.cs
- UxThemeWrapper.cs
- ItemList.cs
- CompilerHelpers.cs
- SqlCacheDependencyDatabaseCollection.cs
- TagPrefixAttribute.cs
- WebResourceAttribute.cs
- InputBindingCollection.cs
- TableAutomationPeer.cs
- XslTransform.cs
- TaiwanLunisolarCalendar.cs
- SQLInt16.cs
- Condition.cs
- RuleSettings.cs
- ValidatorCollection.cs
- TemplateBindingExtensionConverter.cs
- ObjectItemAssemblyLoader.cs
- BindingMAnagerBase.cs
- HandoffBehavior.cs
- _Win32.cs
- ResizingMessageFilter.cs
- ColumnReorderedEventArgs.cs
- AccessedThroughPropertyAttribute.cs
- TextSegment.cs
- OleDbParameterCollection.cs
- ChtmlLinkAdapter.cs
- WorkflowWebHostingModule.cs
- SynchronizationLockException.cs
- DateTimeConstantAttribute.cs
- ProtocolViolationException.cs
- DocumentReferenceCollection.cs
- ITextView.cs
- WriteableBitmap.cs
- SoapProcessingBehavior.cs
- InvalidOleVariantTypeException.cs
- MissingManifestResourceException.cs
- LocationSectionRecord.cs
- DesignOnlyAttribute.cs
- RepeatButtonAutomationPeer.cs
- DataTransferEventArgs.cs
- ResourceContainer.cs
- Types.cs
- ParamArrayAttribute.cs
- XappLauncher.cs
- DesignerAdRotatorAdapter.cs
- ResourceSetExpression.cs
- TypedTableBaseExtensions.cs
- Boolean.cs
- Transform3DCollection.cs
- AlphaSortedEnumConverter.cs
- COM2ExtendedUITypeEditor.cs
- WindowsListViewGroup.cs
- PageCatalogPart.cs
- Positioning.cs
- Mappings.cs
- VersionedStream.cs
- ObjectDataSourceDesigner.cs
- StorageEntitySetMapping.cs
- MarkupExtensionReturnTypeAttribute.cs
- Decimal.cs
- AssociationTypeEmitter.cs
- ActivationServices.cs
- EntityRecordInfo.cs
- rsa.cs
- XPathDescendantIterator.cs
- EncoderNLS.cs
- _HelperAsyncResults.cs
- PackageStore.cs
- QilLoop.cs
- ReaderWriterLockWrapper.cs
- WindowsFormsSectionHandler.cs
- FolderLevelBuildProviderCollection.cs
- TypeSystem.cs
- ApplicationGesture.cs
- VoiceChangeEventArgs.cs