public static Dictionary <string, string> ToDisplayDictionary(this IEntity @this, params string[] propNames) { var type = @this.GetType(); var props = type.GetProperties().Where(x => propNames.Contains(x.Name)); var ret = new Dictionary <string, string>(); foreach (var prop in props) { ret.Add(prop.Name, DataAnnotationEx.GetDisplayString(@this, prop.Name)); } return(ret); }
public static string Display <TEntity, TRet>(this IEntity <TEntity> @this, Expression <Func <TEntity, TRet> > expression, string defaultReturn = "") where TEntity : class, IEntity <TEntity>, new() => DataAnnotationEx.GetDisplayString(@this, expression, defaultReturn);
public static string Display(this IEntity @this, LambdaExpression expression, string defaultReturn = "") => DataAnnotationEx.GetDisplayString(@this, expression, defaultReturn);