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
- SQlBooleanStorage.cs
- _OverlappedAsyncResult.cs
- OracleBinary.cs
- BaseParaClient.cs
- PerformanceCounterPermission.cs
- DataGridViewRowEventArgs.cs
- StylusPointPropertyUnit.cs
- RemotingConfigParser.cs
- ConfigurationStrings.cs
- HttpHandlersSection.cs
- DataGridViewCellStyleChangedEventArgs.cs
- WebPartConnectionCollection.cs
- WindowsFormsHostPropertyMap.cs
- WhitespaceRuleLookup.cs
- PagesSection.cs
- PtsContext.cs
- UrlMappingsSection.cs
- LeftCellWrapper.cs
- GorillaCodec.cs
- ObfuscationAttribute.cs
- XsltCompileContext.cs
- DesignerDataConnection.cs
- BmpBitmapEncoder.cs
- HandlerBase.cs
- QuadTree.cs
- DispatcherBuilder.cs
- BlurBitmapEffect.cs
- TypeUsageBuilder.cs
- _SingleItemRequestCache.cs
- ColumnMapTranslator.cs
- FunctionQuery.cs
- RC2CryptoServiceProvider.cs
- Inline.cs
- ProfileServiceManager.cs
- Parser.cs
- HitTestFilterBehavior.cs
- Ref.cs
- ListDictionary.cs
- StringCollectionEditor.cs
- ProfileProvider.cs
- RemoteWebConfigurationHostServer.cs
- WindowsRebar.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- BuildDependencySet.cs
- Convert.cs
- SchemaExporter.cs
- ScaleTransform.cs
- SchemaImporterExtension.cs
- StateMachineExecutionState.cs
- SpeechDetectedEventArgs.cs
- CroppedBitmap.cs
- SocketInformation.cs
- SqlParameterizer.cs
- XmlParserContext.cs
- GenerateHelper.cs
- WebBrowserEvent.cs
- mediaeventshelper.cs
- StructuredTypeEmitter.cs
- DataColumn.cs
- Metafile.cs
- EncoderReplacementFallback.cs
- PropertyToken.cs
- ClientApiGenerator.cs
- InvalidPropValue.cs
- InputBinder.cs
- XmlWrappingReader.cs
- PackagePartCollection.cs
- AsnEncodedData.cs
- CorrelationActionMessageFilter.cs
- GridSplitterAutomationPeer.cs
- CatalogPartChrome.cs
- PinnedBufferMemoryStream.cs
- InkCanvas.cs
- HitTestParameters.cs
- XmlSchemaNotation.cs
- Scalars.cs
- SudsCommon.cs
- HyperLinkColumn.cs
- SqlMultiplexer.cs
- FontFamilyConverter.cs
- IconBitmapDecoder.cs
- SessionEndingCancelEventArgs.cs
- Misc.cs
- BookmarkScopeInfo.cs
- FontSource.cs
- WebMessageBodyStyleHelper.cs
- RewritingSimplifier.cs
- CLSCompliantAttribute.cs
- ExpressionLexer.cs
- ServiceManagerHandle.cs
- PreparingEnlistment.cs
- FunctionCommandText.cs
- XmlChildNodes.cs
- MemberHolder.cs
- BamlWriter.cs
- PowerStatus.cs
- DiagnosticsConfiguration.cs
- EntityContainerEmitter.cs
- ScopedKnownTypes.cs
- MessageSecurityException.cs