/
UserSecretsIdAttribute.cs
40 lines (36 loc) · 1.35 KB
/
UserSecretsIdAttribute.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
34
35
36
37
38
39
40
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
namespace Microsoft.Extensions.Configuration.UserSecrets
{
/// <summary>
/// <para>
/// Represents the user secrets ID.
/// </para>
/// <para>
/// In most cases, this attribute is automatically generated during compilation by MSBuild targets
/// included in the UserSecrets NuGet package. These targets use the MSBuild property 'UserSecretsId'
/// to set the value for <see cref="UserSecretsId"/>.
/// </para>
/// </summary>
[AttributeUsage(AttributeTargets.Assembly, Inherited = false, AllowMultiple = false)]
public class UserSecretsIdAttribute : Attribute
{
/// <summary>
/// Initializes an instance of <see cref="UserSecretsIdAttribute" />.
/// </summary>
/// <param name="userSecretId">The user secrets ID.</param>
public UserSecretsIdAttribute(string userSecretId)
{
if (string.IsNullOrEmpty(userSecretId))
{
throw new ArgumentException(SR.Common_StringNullOrEmpty, nameof(userSecretId));
}
UserSecretsId = userSecretId;
}
/// <summary>
/// The user secrets ID.
/// </summary>
public string UserSecretsId { get; }
}
}