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
- ChtmlPhoneCallAdapter.cs
- SoapElementAttribute.cs
- UntrustedRecipientException.cs
- MemberListBinding.cs
- ContainsRowNumberChecker.cs
- TextServicesManager.cs
- RemoveStoryboard.cs
- SiteMapProvider.cs
- SqlCommandSet.cs
- Viewport3DVisual.cs
- WsdlImporterElementCollection.cs
- SecurityContextKeyIdentifierClause.cs
- X509CertificateChain.cs
- DataSourceHelper.cs
- PropertyGridEditorPart.cs
- ISCIIEncoding.cs
- TypeInfo.cs
- XPSSignatureDefinition.cs
- ConnectionInterfaceCollection.cs
- BoundingRectTracker.cs
- AlternationConverter.cs
- AppDomainAttributes.cs
- ILGenerator.cs
- SettingsAttributes.cs
- httpstaticobjectscollection.cs
- DragCompletedEventArgs.cs
- X509RecipientCertificateServiceElement.cs
- ImageSourceConverter.cs
- WebPartConnectionsCloseVerb.cs
- MimeMapping.cs
- StringSorter.cs
- _ServiceNameStore.cs
- PersistenceMetadataNamespace.cs
- StringPropertyBuilder.cs
- XmlNavigatorStack.cs
- DataSourceCache.cs
- IpcManager.cs
- RadioButton.cs
- glyphs.cs
- PageHandlerFactory.cs
- EncoderFallback.cs
- ResolvedKeyFrameEntry.cs
- SQLInt64Storage.cs
- EventLogPermissionEntry.cs
- WebPartConnection.cs
- PrintDialog.cs
- LifetimeServices.cs
- StateMachineTimers.cs
- BoundingRectTracker.cs
- AvTraceDetails.cs
- Int16Converter.cs
- XmlImplementation.cs
- ButtonFieldBase.cs
- CryptographicAttribute.cs
- MatrixUtil.cs
- Subtree.cs
- URLString.cs
- FixedLineResult.cs
- HttpCapabilitiesSectionHandler.cs
- CommandField.cs
- Pair.cs
- WSHttpTransportSecurityElement.cs
- DataSourceCacheDurationConverter.cs
- MaskDescriptor.cs
- XmlReader.cs
- AmbientProperties.cs
- XmlSchemaExternal.cs
- XmlIlVisitor.cs
- DefaultTextStoreTextComposition.cs
- RequestSecurityTokenForGetBrowserToken.cs
- VerificationException.cs
- CLSCompliantAttribute.cs
- DataGrid.cs
- Vector3DValueSerializer.cs
- ReadWriteObjectLock.cs
- IconConverter.cs
- JsonWriterDelegator.cs
- ReferenceEqualityComparer.cs
- NominalTypeEliminator.cs
- ApplicationException.cs
- Rectangle.cs
- HandlerMappingMemo.cs
- DeflateStream.cs
- NegotiateStream.cs
- SQLByte.cs
- ButtonField.cs
- ScalarOps.cs
- AuthenticateEventArgs.cs
- CrossAppDomainChannel.cs
- InstalledVoice.cs
- WindowsBrush.cs
- BuildDependencySet.cs
- WinEventQueueItem.cs
- FixedSOMSemanticBox.cs
- RootBrowserWindowAutomationPeer.cs
- AttributeData.cs
- Rights.cs
- XhtmlBasicLabelAdapter.cs
- DataKey.cs
- TransformGroup.cs