using System;
using System.Linq.Expressions;
using Microsoft.AspNetCore.Mvc.Rendering;
namespace Dpz.Core.Web.Pager;
/// <summary>
/// 提供一种从IPagedList<T> 和 PagedList<T>模型中获取显示名称的机制.
/// </summary>
public static class DisplayNameExtensions
{
/// <summary>
/// 获取 PagedList<T> 泛型模型的显示名称;
/// </summary>
/// <typeparam name="TModel"></typeparam>
/// <typeparam name="TValue"></typeparam>
/// <param name="html"></param>
/// <param name="expression"></param>
/// <returns></returns>
public static string DisplayNameFor<TModel, TValue>(
this IHtmlHelper<PagedList<TModel>> html,
Expression<Func<TModel, TValue>> expression
)
{
return html.DisplayNameForInnerType(expression);
}
}
AI 正在分析代码…
评论加载中...