/*--------------------------------------------------------------------------------------------*/ public static IList <WeaverPropPair> GetElementPropertyAttributes(Type pType) { PropertyInfo[] props = pType.GetProperties(); var list = new List <WeaverPropPair>(); foreach (PropertyInfo prop in props) { WeaverPropPair wpp = GetPropertyAttribute(prop); if (wpp != null) { list.Add(wpp); } } return(list); }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ public static WeaverPropPair GetPropertyAttribute <T>(Expression <Func <T, object> > pProp) where T : IWeaverElement { MemberExpression me = GetMemberExpr(pProp); if (me != null) { PropertyInfo pi = (me.Member as PropertyInfo); WeaverPropPair wpp = (pi == null ? null : GetPropertyAttribute(pi)); if (wpp == null) { throw new WeaverException("Unknown property: " + me.Member.Name); } return(wpp); } throw new WeaverException("Item property expression body was of type " + pProp.Body.GetType().Name + ", but must be of type MemberExpression."); }