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
- QueryPageSettingsEventArgs.cs
- BooleanAnimationUsingKeyFrames.cs
- RadioButtonStandardAdapter.cs
- SimpleHandlerBuildProvider.cs
- StrokeDescriptor.cs
- SpotLight.cs
- CodeComment.cs
- FixedSOMTableRow.cs
- Point.cs
- CalendarAutoFormat.cs
- OdbcParameter.cs
- PackWebRequest.cs
- ThreadExceptionDialog.cs
- ContextConfiguration.cs
- List.cs
- HGlobalSafeHandle.cs
- HttpResponseInternalWrapper.cs
- StreamUpgradeInitiator.cs
- Mapping.cs
- DetailsViewRow.cs
- ReflectPropertyDescriptor.cs
- ManagedWndProcTracker.cs
- MimeObjectFactory.cs
- RoleManagerEventArgs.cs
- LineBreak.cs
- HttpCachePolicy.cs
- AnnotationResource.cs
- PerformanceCounterCategory.cs
- Vertex.cs
- ProfileSettings.cs
- FileDialog.cs
- OletxTransactionManager.cs
- Stack.cs
- Walker.cs
- SessionSwitchEventArgs.cs
- SqlConnection.cs
- FillErrorEventArgs.cs
- FontDifferentiator.cs
- XmlDataCollection.cs
- HtmlFormAdapter.cs
- ListParagraph.cs
- AutomationPeer.cs
- StateManagedCollection.cs
- MarkupCompiler.cs
- XmlException.cs
- ContactManager.cs
- ExtractedStateEntry.cs
- altserialization.cs
- AndAlso.cs
- TypeBuilder.cs
- AccessDataSource.cs
- BinHexEncoder.cs
- RectKeyFrameCollection.cs
- SortFieldComparer.cs
- XmlAggregates.cs
- URLMembershipCondition.cs
- VisualStyleTypesAndProperties.cs
- UnicodeEncoding.cs
- HMACSHA256.cs
- EmbeddedMailObjectsCollection.cs
- DataListItemCollection.cs
- ProfessionalColors.cs
- HttpCachePolicy.cs
- PerformanceCounter.cs
- MultipartContentParser.cs
- KeyboardEventArgs.cs
- Stopwatch.cs
- FixedHighlight.cs
- FixedSOMContainer.cs
- SynchronizationLockException.cs
- HScrollProperties.cs
- RuntimeUtils.cs
- BitmapEffectGroup.cs
- ThousandthOfEmRealDoubles.cs
- DataGridViewColumnEventArgs.cs
- LineSegment.cs
- MissingManifestResourceException.cs
- DataSourceExpression.cs
- QilScopedVisitor.cs
- Pair.cs
- DataGridViewMethods.cs
- CurrentTimeZone.cs
- Attachment.cs
- TraceHwndHost.cs
- DayRenderEvent.cs
- Section.cs
- ListViewInsertEventArgs.cs
- ListInitExpression.cs
- Pen.cs
- BeginStoryboard.cs
- ProfessionalColors.cs
- ThemeDictionaryExtension.cs
- DependencyPropertyValueSerializer.cs
- streamingZipPartStream.cs
- SmtpNtlmAuthenticationModule.cs
- Formatter.cs
- QilFunction.cs
- PeerResolverSettings.cs
- WmpBitmapEncoder.cs
- Model3D.cs