-
Notifications
You must be signed in to change notification settings - Fork 4.5k
/
PartCreationPolicyAttribute.cs
33 lines (30 loc) · 1.45 KB
/
PartCreationPolicyAttribute.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System.ComponentModel.Composition
{
/// <summary>
/// Specifies <see cref="CreationPolicy"/> for a given <see cref="Primitives.ComposablePart" />.
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
public sealed class PartCreationPolicyAttribute : Attribute
{
internal static PartCreationPolicyAttribute Default = new PartCreationPolicyAttribute(CreationPolicy.Any);
internal static PartCreationPolicyAttribute Shared = new PartCreationPolicyAttribute(CreationPolicy.Shared);
/// <summary>
/// Initializes a new instance of the <see cref="PartCreationPolicyAttribute"/> class.
/// </summary>
public PartCreationPolicyAttribute(CreationPolicy creationPolicy)
{
CreationPolicy = creationPolicy;
}
/// <summary>
/// Gets or sets a value indicating the creation policy of the attributed part.
/// </summary>
/// <value>
/// One of the <see cref="CreationPolicy"/> values indicating the creation policy of the
/// attributed part. The default is
/// <see cref="System.ComponentModel.Composition.CreationPolicy.Any"/>.
/// </value>
public CreationPolicy CreationPolicy { get; private set; }
}
}