Code:
/ FX-1434 / FX-1434 / 1.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
- AdornedElementPlaceholder.cs
- DtdParser.cs
- CompressEmulationStream.cs
- ObjectQueryState.cs
- SimpleType.cs
- WebException.cs
- ThreadStaticAttribute.cs
- OleAutBinder.cs
- DataGridViewCellParsingEventArgs.cs
- FixedSOMTable.cs
- PointLightBase.cs
- EncoderFallback.cs
- PixelFormats.cs
- XPathAncestorQuery.cs
- OutputCacheSettingsSection.cs
- ClockGroup.cs
- PerformanceCounterLib.cs
- XmlSchemaAttributeGroup.cs
- CanonicalFontFamilyReference.cs
- SystemIcmpV6Statistics.cs
- ProviderIncompatibleException.cs
- Renderer.cs
- Bold.cs
- SubqueryTrackingVisitor.cs
- KeyConstraint.cs
- CollectionType.cs
- MarkupCompiler.cs
- SQLBoolean.cs
- InvalidCastException.cs
- LinkedList.cs
- SettingsProviderCollection.cs
- X509CertificateChain.cs
- SettingsSavedEventArgs.cs
- XPathDocument.cs
- ApplicationFileCodeDomTreeGenerator.cs
- TreeViewImageKeyConverter.cs
- DummyDataSource.cs
- ExtensibleClassFactory.cs
- FileSecurity.cs
- wmiprovider.cs
- TextSearch.cs
- TypeSchema.cs
- TypeForwardedToAttribute.cs
- CommonDialog.cs
- CardSpaceException.cs
- FixedTextView.cs
- ReadContentAsBinaryHelper.cs
- DataSourceControl.cs
- DataStorage.cs
- ResourcePart.cs
- ToolStripContentPanelRenderEventArgs.cs
- DecoderNLS.cs
- ExplicitDiscriminatorMap.cs
- ListChangedEventArgs.cs
- SpecialNameAttribute.cs
- BinaryObjectReader.cs
- Enum.cs
- PrePrepareMethodAttribute.cs
- Privilege.cs
- SafeNativeMethods.cs
- Int32Rect.cs
- CacheMemory.cs
- DataProtection.cs
- ProvidersHelper.cs
- LayoutInformation.cs
- BitmapSizeOptions.cs
- HtmlEncodedRawTextWriter.cs
- SequentialUshortCollection.cs
- HyperLinkField.cs
- ListViewPagedDataSource.cs
- SqlTypeSystemProvider.cs
- CodeLabeledStatement.cs
- ComplusEndpointConfigContainer.cs
- Point3DAnimationUsingKeyFrames.cs
- ListItemParagraph.cs
- XmlSchemaSimpleContentExtension.cs
- InvariantComparer.cs
- MarkupWriter.cs
- ObjectDisposedException.cs
- DateTimeSerializationSection.cs
- StandardToolWindows.cs
- FragmentQuery.cs
- AccessibilityHelperForVista.cs
- SQLBytesStorage.cs
- ApplicationServiceHelper.cs
- FlagsAttribute.cs
- Label.cs
- BooleanFunctions.cs
- DescendentsWalker.cs
- WebPartConnectionsEventArgs.cs
- ListBoxChrome.cs
- Control.cs
- DriveNotFoundException.cs
- FontFamily.cs
- LineServicesCallbacks.cs
- EventToken.cs
- GradientBrush.cs
- RequestCachingSection.cs
- HtmlImage.cs
- FloatUtil.cs