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
- GradientSpreadMethodValidation.cs
- ReceiveActivityDesigner.cs
- NavigatorOutput.cs
- XmlSchemaSimpleTypeList.cs
- DesignerWidgets.cs
- MtomMessageEncoder.cs
- ResourceReferenceKeyNotFoundException.cs
- TextView.cs
- TextTreeRootNode.cs
- Int16Animation.cs
- MachineKeyValidationConverter.cs
- MenuItemStyle.cs
- XmlAnyElementAttribute.cs
- TypefaceMetricsCache.cs
- BaseValidator.cs
- AudioFormatConverter.cs
- TypographyProperties.cs
- MetadataArtifactLoaderComposite.cs
- Utils.cs
- StringResourceManager.cs
- Propagator.JoinPropagator.JoinPredicateVisitor.cs
- Panel.cs
- ClientSettings.cs
- Codec.cs
- BinaryKeyIdentifierClause.cs
- ProvidersHelper.cs
- AmbientLight.cs
- Stylesheet.cs
- PrintEvent.cs
- DateTimeFormat.cs
- dbenumerator.cs
- AppSettingsReader.cs
- DBSqlParserTableCollection.cs
- SmtpNegotiateAuthenticationModule.cs
- querybuilder.cs
- SystemNetHelpers.cs
- SecurityState.cs
- StyleBamlTreeBuilder.cs
- DataObjectCopyingEventArgs.cs
- DbTransaction.cs
- OutKeywords.cs
- ArraySortHelper.cs
- entityreference_tresulttype.cs
- DiagnosticTrace.cs
- ProfileProvider.cs
- StackBuilderSink.cs
- AttachedPropertyMethodSelector.cs
- CssStyleCollection.cs
- XomlSerializationHelpers.cs
- HtmlTableRowCollection.cs
- XpsPackagingException.cs
- BStrWrapper.cs
- ResponseStream.cs
- EntityTransaction.cs
- RepeaterItem.cs
- StrokeFIndices.cs
- PackageRelationship.cs
- SQLString.cs
- ThreadStateException.cs
- LiteralControl.cs
- ImageSourceConverter.cs
- HttpWebRequestElement.cs
- PolyLineSegment.cs
- SettingsBindableAttribute.cs
- TdsParserStateObject.cs
- TextEditorContextMenu.cs
- ExpressionSelection.cs
- ComPlusDiagnosticTraceRecords.cs
- MobileUserControl.cs
- ObjectPersistData.cs
- ExpressionNode.cs
- CellRelation.cs
- XPathAxisIterator.cs
- RenderOptions.cs
- BufferedReadStream.cs
- RowUpdatedEventArgs.cs
- SiteMapDataSourceView.cs
- SiteMapDataSource.cs
- PageTheme.cs
- XmlRawWriter.cs
- FormViewDeleteEventArgs.cs
- ButtonBase.cs
- HierarchicalDataTemplate.cs
- ArithmeticException.cs
- ADConnectionHelper.cs
- ServerIdentity.cs
- LeafCellTreeNode.cs
- CapiSymmetricAlgorithm.cs
- SiteMapDataSourceView.cs
- QueryOperator.cs
- FontNamesConverter.cs
- DLinqTableProvider.cs
- CodeMemberEvent.cs
- EntityPropertyMappingAttribute.cs
- WeakHashtable.cs
- Models.cs
- ProfileModule.cs
- TreeWalkHelper.cs
- DocumentXPathNavigator.cs
- UpdateManifestForBrowserApplication.cs