Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / System / data / design / NameService.cs / 2 / NameService.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All Rights Reserved. // Information Contained Herein is Proprietary and Confidential. // //----------------------------------------------------------------------------- namespace System.Data.Design { using System; using System.Collections; using System.Globalization; ////// internal interface INamedObject { string Name { get; set; } } ////// Indicates a collection of objects that support INamedObject. /// internal interface INamedObjectCollection: ICollection { INameService GetNameService(); // Might return null. } ////// A name service can be used for many INamedObjectCollection /// internal interface INameService { // Create UniqueName will always return a valid and unique name // string CreateUniqueName( INamedObjectCollection container, Type type ); string CreateUniqueName( INamedObjectCollection container, string proposed ); string CreateUniqueName( INamedObjectCollection container, string proposedNameRoot, int startSuffix); // ValidateName does not check if the name is unque void ValidateName( string name ); // Should throw NameValidationException when invalid name passed. // Check if the name is unique and valid void ValidateUniqueName( INamedObjectCollection container, string name ); // Should throw NameValidationException when invalid name passed. // Check if the name is unique and valid // This function is useful when renaming an existing object. void ValidateUniqueName(INamedObjectCollection container, INamedObject namedObject, string proposedName); // Should throw NameValidationException when invalid name passed. } ////// internal class NamedObjectUtil { ////// Private contstructor to avoid class being instantiated. /// private NamedObjectUtil() { } public static INamedObject Find( INamedObjectCollection coll, string name ) { return NamedObjectUtil.Find( (ICollection) coll, name, false); } private static INamedObject Find( ICollection coll, string name, bool ignoreCase) { IEnumerator e = coll.GetEnumerator(); while( e.MoveNext() ) { INamedObject n = e.Current as INamedObject; if( n == null ) { throw new InternalException( VSDExceptions.COMMON.NOT_A_NAMED_OBJECT_MSG, VSDExceptions.COMMON.NOT_A_NAMED_OBJECT_CODE ); } if( StringUtil.EqualValue(n.Name, name, ignoreCase)) { return n; } } return null; } } ////// [Serializable] internal sealed class NameValidationException: ApplicationException { public NameValidationException( string message ) : base( message ) {} // No additional fields defined so we do not have to override default ISerializable implementation } } // 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
- ApplicationTrust.cs
- LineSegment.cs
- DataRowComparer.cs
- WebPartConnectVerb.cs
- Journal.cs
- X509SecurityTokenAuthenticator.cs
- NonParentingControl.cs
- InfiniteTimeSpanConverter.cs
- SqlNotificationRequest.cs
- SafeTimerHandle.cs
- HashSet.cs
- TextMarkerSource.cs
- MetadataArtifactLoaderComposite.cs
- CallContext.cs
- PairComparer.cs
- StringComparer.cs
- ListViewItemSelectionChangedEvent.cs
- CreateSequence.cs
- StorageAssociationTypeMapping.cs
- ActivityDesignerResources.cs
- DataGridTextBoxColumn.cs
- SoundPlayer.cs
- Int32Rect.cs
- FakeModelPropertyImpl.cs
- UnionCodeGroup.cs
- HtmlDocument.cs
- ContainerActivationHelper.cs
- TemplatedEditableDesignerRegion.cs
- ConnectionModeReader.cs
- PermissionSet.cs
- XsltArgumentList.cs
- AttributeEmitter.cs
- PointAnimationClockResource.cs
- ObjectItemConventionAssemblyLoader.cs
- RectangleF.cs
- DoWorkEventArgs.cs
- LinqDataSource.cs
- ISAPIRuntime.cs
- CodeAccessPermission.cs
- DataGridRow.cs
- __FastResourceComparer.cs
- PnrpPeerResolverBindingElement.cs
- ImageCodecInfo.cs
- EntityConnectionStringBuilderItem.cs
- WizardSideBarListControlItem.cs
- DefinitionBase.cs
- CorrelationService.cs
- AnnotationHighlightLayer.cs
- FolderBrowserDialog.cs
- UnmanagedMarshal.cs
- SqlDeflator.cs
- DynamicDocumentPaginator.cs
- RawStylusInputCustomDataList.cs
- ContextMenu.cs
- ECDiffieHellmanPublicKey.cs
- StrokeNodeEnumerator.cs
- BufferedMessageData.cs
- InkCanvasInnerCanvas.cs
- Transform.cs
- StartFileNameEditor.cs
- DataBoundControlAdapter.cs
- MediaScriptCommandRoutedEventArgs.cs
- RNGCryptoServiceProvider.cs
- NotCondition.cs
- MarkedHighlightComponent.cs
- XmlTextAttribute.cs
- QuaternionRotation3D.cs
- SizeChangedInfo.cs
- AncestorChangedEventArgs.cs
- ScrollContentPresenter.cs
- InstanceNameConverter.cs
- XdrBuilder.cs
- SystemWebCachingSectionGroup.cs
- ResourceContainer.cs
- HWStack.cs
- DBDataPermissionAttribute.cs
- UnsignedPublishLicense.cs
- TranslateTransform.cs
- CellConstant.cs
- RegisterResponseInfo.cs
- StaticTextPointer.cs
- TextBoxAutoCompleteSourceConverter.cs
- InteropBitmapSource.cs
- sortedlist.cs
- StorageAssociationTypeMapping.cs
- AppLevelCompilationSectionCache.cs
- InputBinding.cs
- TreeBuilderBamlTranslator.cs
- MessageHeaders.cs
- InputLangChangeEvent.cs
- HMACSHA1.cs
- GradientBrush.cs
- ResourceDescriptionAttribute.cs
- XslTransformFileEditor.cs
- EventRecordWrittenEventArgs.cs
- HashAlgorithm.cs
- NullableConverter.cs
- BoundColumn.cs
- SupportsEventValidationAttribute.cs
- NetStream.cs