This repository has been archived by the owner on Dec 14, 2018. It is now read-only.
/
DisplayMetadataProviderContext.cs
61 lines (52 loc) · 2 KB
/
DisplayMetadataProviderContext.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
namespace Microsoft.AspNetCore.Mvc.ModelBinding.Metadata
{
/// <summary>
/// A context for and <see cref="IDisplayMetadataProvider"/>.
/// </summary>
public class DisplayMetadataProviderContext
{
/// <summary>
/// Creates a new <see cref="DisplayMetadataProviderContext"/>.
/// </summary>
/// <param name="key">The <see cref="ModelMetadataIdentity"/> for the <see cref="ModelMetadata"/>.</param>
/// <param name="attributes">The attributes for the <see cref="ModelMetadata"/>.</param>
public DisplayMetadataProviderContext(
ModelMetadataIdentity key,
ModelAttributes attributes)
{
if (attributes == null)
{
throw new ArgumentNullException(nameof(attributes));
}
Key = key;
Attributes = attributes.Attributes;
PropertyAttributes = attributes.PropertyAttributes;
TypeAttributes = attributes.TypeAttributes;
DisplayMetadata = new DisplayMetadata();
}
/// <summary>
/// Gets the attributes.
/// </summary>
public IReadOnlyList<object> Attributes { get; }
/// <summary>
/// Gets the <see cref="Metadata.DisplayMetadata"/>.
/// </summary>
public DisplayMetadata DisplayMetadata { get; }
/// <summary>
/// Gets the <see cref="ModelMetadataIdentity"/>.
/// </summary>
public ModelMetadataIdentity Key { get; }
/// <summary>
/// Gets the property attributes.
/// </summary>
public IReadOnlyList<object> PropertyAttributes { get; }
/// <summary>
/// Gets the type attributes.
/// </summary>
public IReadOnlyList<object> TypeAttributes { get; }
}
}