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.
14 lines
467 B
14 lines
467 B
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace Infrastructure.Extensions
|
|
{
|
|
public static class ControllerExtensions
|
|
{
|
|
public static ModelMetadata GetModelMetadata<T>(this ControllerBase controller)
|
|
{
|
|
return controller.HttpContext.RequestServices.GetRequiredService<IModelMetadataProvider>().GetMetadataForType(typeof(T));
|
|
}
|
|
}
|
|
} |