// Copyright (c) Microsoft Open Technologies, Inc. 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; using System.ComponentModel.DataAnnotations; using System.Linq; namespace Microsoft.AspNet.Mvc.ModelBinding { public class CachedDataAnnotationsMetadataAttributes { public CachedDataAnnotationsMetadataAttributes(IEnumerable attributes) { Display = attributes.OfType().FirstOrDefault(); DisplayFormat = attributes.OfType().FirstOrDefault(); DisplayColumn = attributes.OfType().FirstOrDefault(); Editable = attributes.OfType().FirstOrDefault(); Required = attributes.OfType().FirstOrDefault(); } public DisplayAttribute Display { get; protected set; } public DisplayFormatAttribute DisplayFormat { get; protected set; } public DisplayColumnAttribute DisplayColumn { get; protected set; } public EditableAttribute Editable { get; protected set; } public RequiredAttribute Required { get; protected set; } } }