1 // -----------------------------------------------------------------------
\r
2 // Copyright (c) Microsoft Corporation. All rights reserved.
\r
3 // -----------------------------------------------------------------------
\r
5 using System.ComponentModel.Composition.Primitives;
\r
7 namespace System.ComponentModel.Composition
\r
10 /// Specifies <see cref="CreationPolicy"/> for a given <see cref="ComposablePart" />.
\r
12 [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
\r
13 public sealed class PartCreationPolicyAttribute : Attribute
\r
15 internal static PartCreationPolicyAttribute Default = new PartCreationPolicyAttribute(CreationPolicy.Any);
\r
16 internal static PartCreationPolicyAttribute Shared = new PartCreationPolicyAttribute(CreationPolicy.Shared);
\r
19 /// Initializes a new instance of the <see cref="PartCreationPolicyAttribute"/> class.
\r
21 public PartCreationPolicyAttribute(CreationPolicy creationPolicy)
\r
23 this.CreationPolicy = creationPolicy;
\r
27 /// Gets or sets a value indicating the creation policy of the attributed part.
\r
30 /// One of the <see cref="CreationPolicy"/> values indicating the creation policy of the
\r
31 /// attributed part. The default is
\r
32 /// <see cref="System.ComponentModel.Composition.CreationPolicy.Any"/>.
\r
34 public CreationPolicy CreationPolicy { get; private set; }
\r