1 // -----------------------------------------------------------------------
\r
2 // Copyright (c) Microsoft Corporation. All rights reserved.
\r
3 // -----------------------------------------------------------------------
\r
5 using System.ComponentModel.Composition.Hosting;
\r
6 using System.Diagnostics.CodeAnalysis;
\r
8 namespace System.ComponentModel.Composition
\r
11 /// Specifies that a type or interface that provides a particular export.
\r
13 [SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")]
\r
14 [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true, Inherited = true)]
\r
15 public class InheritedExportAttribute : ExportAttribute
\r
18 /// Initializes a new instance of the <see cref="ExportAttribute"/> class, exporting the
\r
19 /// type marked with this attribute under the default contract name.
\r
23 /// The default contract name is the result of calling
\r
24 /// <see cref="AttributedModelServices.GetContractName(Type)"/> on the type itself,
\r
25 /// that is marked with this attribute.
\r
28 /// The contract name is compared using a case-sensitive, non-linguistic comparison
\r
29 /// using <see cref="StringComparer.Ordinal"/>.
\r
32 public InheritedExportAttribute()
\r
33 : this((string)null, (Type)null)
\r
38 /// Initializes a new instance of the <see cref="ExportAttribute"/> class, exporting the
\r
39 /// type marked with this attribute under a contract name derived from the specified type.
\r
41 /// <param name="contractType">
\r
42 /// A <see cref="Type"/> of which to derive the contract name to export the type
\r
43 /// marked with this attribute, under; or <see langword="null"/> to use the
\r
44 /// default contract name.
\r
48 /// The contract name is the result of calling
\r
49 /// <see cref="AttributedModelServices.GetContractName(Type)"/> on
\r
50 /// <paramref name="contractType"/>.
\r
53 /// The default contract name is the result of calling
\r
54 /// <see cref="AttributedModelServices.GetContractName(Type)"/> on the type of the
\r
55 /// itself, that is marked with this attribute.
\r
58 /// The contract name is compared using a case-sensitive, non-linguistic comparison
\r
59 /// using <see cref="StringComparer.Ordinal"/>.
\r
62 public InheritedExportAttribute(Type contractType)
\r
63 : this((string)null, contractType)
\r
68 /// Initializes a new instance of the <see cref="ExportAttribute"/> class, exporting the
\r
69 /// type or member marked with this attribute under the specified contract name.
\r
71 /// <param name="contractName">
\r
72 /// A <see cref="String"/> containing the contract name to export the type
\r
73 /// marked with this attribute, under; or <see langword="null"/> or an empty string
\r
74 /// ("") to use the default contract name.
\r
78 /// The default contract name is the result of calling
\r
79 /// <see cref="AttributedModelServices.GetContractName(Type)"/> on
\r
80 /// the type itself that this is marked with this attribute.
\r
83 /// The contract name is compared using a case-sensitive, non-linguistic comparison
\r
84 /// using <see cref="StringComparer.Ordinal"/>.
\r
87 public InheritedExportAttribute(string contractName)
\r
88 : this(contractName, (Type)null)
\r
93 /// Initializes a new instance of the <see cref="ExportAttribute"/> class, exporting the
\r
94 /// type or member marked with this attribute under the specified contract name.
\r
96 /// <param name="contractName">
\r
97 /// A <see cref="String"/> containing the contract name to export the type
\r
98 /// marked with this attribute, under; or <see langword="null"/> or an empty string
\r
99 /// ("") to use the default contract name.
\r
101 /// <param name="contractType">
\r
102 /// A <see cref="Type"/> of which to derive the contract name to export the type
\r
103 /// marked with this attribute, under; or <see langword="null"/> to use the
\r
104 /// default contract name.
\r
108 /// The default contract name is the result of calling
\r
109 /// <see cref="AttributedModelServices.GetContractName(Type)"/> on
\r
110 /// the type itself that this is marked with this attribute.
\r
113 /// The contract name is compared using a case-sensitive, non-linguistic comparison
\r
114 /// using <see cref="StringComparer.Ordinal"/>.
\r
117 public InheritedExportAttribute(string contractName, Type contractType)
\r
118 : base(contractName, contractType)
\r