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
- SendKeys.cs
- XmlSchemaAnnotated.cs
- HtmlElementErrorEventArgs.cs
- FormsAuthenticationModule.cs
- TemplateBamlTreeBuilder.cs
- CustomErrorsSection.cs
- ColorConvertedBitmap.cs
- DataObjectFieldAttribute.cs
- XmlDocumentType.cs
- FamilyTypefaceCollection.cs
- RoleManagerSection.cs
- _CacheStreams.cs
- SendKeys.cs
- DataGridViewAutoSizeModeEventArgs.cs
- SiteMapDataSource.cs
- FlowLayoutPanel.cs
- MouseEventArgs.cs
- CodePageUtils.cs
- RepeatButtonAutomationPeer.cs
- SecurityBindingElementImporter.cs
- Switch.cs
- ParameterToken.cs
- TextFindEngine.cs
- SiteMapPath.cs
- DocumentViewerAutomationPeer.cs
- MultiAsyncResult.cs
- ProfileParameter.cs
- _emptywebproxy.cs
- PolicyException.cs
- ExternalCalls.cs
- SignatureToken.cs
- FlowDocument.cs
- TreeViewDataItemAutomationPeer.cs
- Helper.cs
- QilCloneVisitor.cs
- ConfigurationElement.cs
- RawUIStateInputReport.cs
- HttpContext.cs
- HTTPNotFoundHandler.cs
- ProjectionPruner.cs
- MatrixAnimationUsingPath.cs
- OneOfScalarConst.cs
- sqlpipe.cs
- ToolStripDropTargetManager.cs
- PageSettings.cs
- EditingCommands.cs
- TableDetailsRow.cs
- XmlProcessingInstruction.cs
- ConnectionPoint.cs
- HostnameComparisonMode.cs
- StylusButtonEventArgs.cs
- FontInfo.cs
- RectAnimationBase.cs
- ZipIOModeEnforcingStream.cs
- ColorMap.cs
- CircleHotSpot.cs
- GatewayIPAddressInformationCollection.cs
- SQLInt64.cs
- SiteMapHierarchicalDataSourceView.cs
- LambdaCompiler.Unary.cs
- BindingBase.cs
- SignedXml.cs
- RowVisual.cs
- TypeValidationEventArgs.cs
- DateTimeParse.cs
- SuppressMergeCheckAttribute.cs
- DuplicateDetector.cs
- DBSchemaRow.cs
- TraceHandlerErrorFormatter.cs
- ServerValidateEventArgs.cs
- BufferModeSettings.cs
- LocatorManager.cs
- KnownBoxes.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- SocketElement.cs
- DebugView.cs
- Line.cs
- IsolatedStorageFile.cs
- CompatibleComparer.cs
- Propagator.cs
- TextSchema.cs
- ApplyTemplatesAction.cs
- StopStoryboard.cs
- OutputCacheProfile.cs
- CodeGenerator.cs
- VectorCollectionConverter.cs
- NetMsmqBindingCollectionElement.cs
- NetNamedPipeSecurity.cs
- Blend.cs
- StylusCaptureWithinProperty.cs
- PropertyGridEditorPart.cs
- ResourceCategoryAttribute.cs
- EventItfInfo.cs
- TreeChangeInfo.cs
- RuleSettings.cs
- OracleException.cs
- HttpProfileGroupBase.cs
- ContextMenuStrip.cs
- _SslSessionsCache.cs
- FileRecordSequenceHelper.cs