feat: 显示名称支持私有字段

This commit is contained in:
Argo-2016 2020-01-12 11:17:39 +08:00
parent e800e1889c
commit d0ecd71a46
2 changed files with 3 additions and 2 deletions

View File

@ -93,7 +93,7 @@ namespace Bootstrap.Admin.Components
var cacheKey = (ModelType: fieldIdentifier.Model.GetType(), fieldIdentifier.FieldName);
if (!_propertyInfoCache.TryGetValue(cacheKey, out propertyInfo))
{
propertyInfo = cacheKey.ModelType.GetProperty(cacheKey.FieldName);
propertyInfo = cacheKey.ModelType.GetProperty(cacheKey.FieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
_propertyInfoCache[cacheKey] = propertyInfo;
}

View File

@ -1,4 +1,4 @@
using System.ComponentModel;
using System.ComponentModel;
using Bootstrap.Admin.Models;
using Bootstrap.Admin.Shared;
using Bootstrap.Security;
@ -41,6 +41,7 @@ namespace Bootstrap.Pages.Admin.Components
/// <summary>
/// 获得/设置 当前用户显示名称
/// </summary>
[DisplayName("显示名称")]
protected string DisplayName { get; set; } = "";
/// <summary>