/// <summary>
/// 用户控件类型及自动保存属性成员缓冲字典
/// </summary>
protected static dictionary<type, memberinfo[]> cachedic = null;
/// <summary>
/// 获得成员列表的绑定标识.
/// </summary>
protected static bindingflags flag;
/// <summary>
/// 初始化 <see cref="basepage"/> 类.
/// </summary>
static basepage()
{
cachedic = new dictionary<type, memberinfo[]>();
flag = bindingflags.public | bindingflags.nonpublic | bindingflags.instance | bindingflags.getfield | bindingflags.getproperty | bindingflags.flattenhierarchy;
}
/// <summary>
/// 当前页面的类型
/// </summary>
protected type currtype = null;
/// <summary>
/// 初始化当前页面的缓冲字典
/// </summary>
protected void initcachedic()
{
// 获得当前实例类型
currtype = page.gettype();
memberinfo[] mems = null;
if (!cachedic.trygetvalue(currtype, out mems))
{
// 自动保存属性处理
var list = currtype.getmembers(flag)
.where(p => attribute.isdefined(p, typeof(autosave), false))
.toarray();
cachedic[currtype] = list;
}
}