The Labs \ Source Viewer \ SSCLI \ System.ComponentModel.Design.Serialization \ INameCreationService

  1. //------------------------------------------------------------------------------
  2. // <copyright file="INameCreationService.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. //------------------------------------------------------------------------------
  15. namespace System.ComponentModel.Design.Serialization
  16. {
  17.    
  18.     using System;
  19.     using System.Collections;
  20.     using System.ComponentModel.Design;
  21.    
  22.     /// <devdoc>
  23.     /// This service may be provided by a designer loader to provide
  24.     /// a way for the designer to fabricate new names for objects.
  25.     /// If this service isn't available the designer will choose a
  26.     /// default implementation.
  27.     /// </devdoc>
  28.     public interface INameCreationService
  29.     {
  30.        
  31.         /// <devdoc>
  32.         /// Creates a new name that is unique to all the components
  33.         /// in the given container. The name will be used to create
  34.         /// an object of the given data type, so the service may
  35.         /// derive a name from the data type's name. The container
  36.         /// parameter can be null if no container search is needed.
  37.         /// </devdoc>
  38.         string CreateName(IContainer container, Type dataType);
  39.        
  40.         /// <devdoc>
  41.         /// Determines if the given name is valid. A name
  42.         /// creation service may have rules defining a valid
  43.         /// name, and this method allows the sevice to enforce
  44.         /// those rules.
  45.         /// </devdoc>
  46.         bool IsValidName(string name);
  47.        
  48.         /// <devdoc>
  49.         /// Determines if the given name is valid. A name
  50.         /// creation service may have rules defining a valid
  51.         /// name, and this method allows the sevice to enforce
  52.         /// those rules. It is similar to IsValidName, except
  53.         /// that this method will throw an exception if the
  54.         /// name is invalid. This allows implementors to provide
  55.         /// rich information in the exception message.
  56.         /// </devdoc>
  57.         void ValidateName(string name);
  58.     }
  59. }

Developer Fusion