/// <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( [NotNull] ModelMetadataIdentity key, [NotNull] IReadOnlyList<object> attributes) { Key = key; Attributes = attributes; DisplayMetadata = new DisplayMetadata(); }
/// <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( [NotNull] ModelMetadataIdentity key, [NotNull] IReadOnlyList <object> attributes) { Key = key; Attributes = attributes; DisplayMetadata = new DisplayMetadata(); }
/// <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( [NotNull] ModelMetadataIdentity key, [NotNull] ModelAttributes attributes) { Key = key; Attributes = attributes.Attributes; PropertyAttributes = attributes.PropertyAttributes; TypeAttributes = attributes.TypeAttributes; DisplayMetadata = new DisplayMetadata(); }
/// <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(); }
private static bool IsTransformRequired( string propertyName, DisplayMetadata modelMetadata, IReadOnlyList<object> propertyAttributes) { if (!string.IsNullOrEmpty(modelMetadata.SimpleDisplayProperty)) { return false; } if (propertyAttributes.Any(a => a is DisplayAttribute)) { return false; } return !string.IsNullOrEmpty(propertyName); }