AliasRepositoryAttribute.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #region Apache License
  2. //
  3. // Licensed to the Apache Software Foundation (ASF) under one or more
  4. // contributor license agreements. See the NOTICE file distributed with
  5. // this work for additional information regarding copyright ownership.
  6. // The ASF licenses this file to you under the Apache License, Version 2.0
  7. // (the "License"); you may not use this file except in compliance with
  8. // the License. You may obtain a copy of the License at
  9. //
  10. // http://www.apache.org/licenses/LICENSE-2.0
  11. //
  12. // Unless required by applicable law or agreed to in writing, software
  13. // distributed under the License is distributed on an "AS IS" BASIS,
  14. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. // See the License for the specific language governing permissions and
  16. // limitations under the License.
  17. //
  18. #endregion
  19. // .NET Compact Framework 1.0 has no support for reading assembly attributes
  20. #if !NETCF
  21. using System;
  22. namespace log4net.Config
  23. {
  24. /// <summary>
  25. /// Assembly level attribute that specifies a repository to alias to this assembly's repository.
  26. /// </summary>
  27. /// <remarks>
  28. /// <para>
  29. /// An assembly's logger repository is defined by its <see cref="RepositoryAttribute"/>,
  30. /// however this can be overridden by an assembly loaded before the target assembly.
  31. /// </para>
  32. /// <para>
  33. /// An assembly can alias another assembly's repository to its repository by
  34. /// specifying this attribute with the name of the target repository.
  35. /// </para>
  36. /// <para>
  37. /// This attribute can only be specified on the assembly and may be used
  38. /// as many times as necessary to alias all the required repositories.
  39. /// </para>
  40. /// </remarks>
  41. /// <author>Nicko Cadell</author>
  42. /// <author>Gert Driesen</author>
  43. [AttributeUsage(AttributeTargets.Assembly,AllowMultiple=true)]
  44. [Serializable]
  45. public /*sealed*/ class AliasRepositoryAttribute : Attribute
  46. {
  47. //
  48. // Class is not sealed because AliasDomainAttribute extends it while it is obsoleted
  49. //
  50. #region Public Instance Constructors
  51. /// <summary>
  52. /// Initializes a new instance of the <see cref="AliasRepositoryAttribute" /> class with
  53. /// the specified repository to alias to this assembly's repository.
  54. /// </summary>
  55. /// <param name="name">The repository to alias to this assemby's repository.</param>
  56. /// <remarks>
  57. /// <para>
  58. /// Initializes a new instance of the <see cref="AliasRepositoryAttribute" /> class with
  59. /// the specified repository to alias to this assembly's repository.
  60. /// </para>
  61. /// </remarks>
  62. public AliasRepositoryAttribute(string name)
  63. {
  64. Name = name;
  65. }
  66. #endregion Public Instance Constructors
  67. #region Public Instance Properties
  68. /// <summary>
  69. /// Gets or sets the repository to alias to this assemby's repository.
  70. /// </summary>
  71. /// <value>
  72. /// The repository to alias to this assemby's repository.
  73. /// </value>
  74. /// <remarks>
  75. /// <para>
  76. /// The name of the repository to alias to this assemby's repository.
  77. /// </para>
  78. /// </remarks>
  79. public string Name
  80. {
  81. get { return m_name; }
  82. set { m_name = value ; }
  83. }
  84. #endregion Public Instance Properties
  85. #region Private Instance Fields
  86. private string m_name = null;
  87. #endregion Private Instance Fields
  88. }
  89. }
  90. #endif // !NETCF