/// <summary> /// 添加需要映射的属性成员。 /// </summary> /// <param name="propertyInfo"></param> /// <returns></returns> public ObjectAccessor <T> AppendProperty(IMetaPropertyInfo propertyInfo) { if (propertyInfo == null) { throw new ArgumentNullException("propertyInfo"); } MetaInfo.AddPropertyInfo(propertyInfo); return(this); }
/// <summary> /// 添加需要映射的属性成员。 /// </summary> /// <param name="propertyExp"></param> /// <param name="propertyName"></param> /// <returns></returns> public ObjectAccessor <T> AppendProperty(Expression <Func <T, object> > propertyExp, string propertyName) { if (propertyExp == null) { throw new ArgumentNullException("propertyExp"); } if (string.IsNullOrEmpty(propertyName)) { throw new ArgumentNullException("propertyName"); } var propertyInfo = PropertyExpression.ExtractMemberExpression(propertyExp); MetaInfo.AddPropertyInfo(new MetaPropertyInfo(MetaInfo, propertyName, (PropertyInfo)propertyInfo.Member)); return(this); }