You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
798 B
25 lines
798 B
using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;
|
|
|
|
namespace Infrastructure.Web.Mvc.ModelBinding.Metadata
|
|
{
|
|
public class AdditionalMetadataProvider : IDisplayMetadataProvider
|
|
{
|
|
public AdditionalMetadataProvider()
|
|
{
|
|
}
|
|
|
|
public void CreateDisplayMetadata(DisplayMetadataProviderContext context)
|
|
{
|
|
if (context != null && context.PropertyAttributes != null)
|
|
{
|
|
foreach (object propAttr in context.PropertyAttributes)
|
|
{
|
|
if (propAttr is AdditionalMetadataAttribute addMetaAttr)
|
|
{
|
|
context.DisplayMetadata.AdditionalValues.Add(addMetaAttr.Name, addMetaAttr.Value);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |