public PropertyDescriptorCollection GetProperties(Attribute[] attributes) { //PropertyDescriptorCollection baseProps = TypeDescriptor.GetProperties(this.obj, attributes, true); // IList addProps = new ArrayList() ; // // foreach (PropertyDescriptor baseProp in baseProps) // { // IPropertyMap propertyMap = this.ClassMap.GetPropertyMap(baseProp.Name); // if (propertyMap != null) // { // if (propertyMap.ReferenceType == ReferenceType.None) // { // addProps.Add(baseProp); // } // } // } ParameterInfo[] paramInfos = methodInfo.GetParameters(); if (propertyDescriptorCollection == null) { PropertyDescriptor[] newProps = new PropertyDescriptor[paramInfos.Length]; for (int i = 0; i < paramInfos.Length; i++) { newProps[i] = new MethodParameterTypeDescriptor(this.obj, paramInfos[i], this.methodInfo); } propertyDescriptorCollection = new PropertyDescriptorCollection(newProps); } return(propertyDescriptorCollection); }
public object InvokeMethod(MethodProperties methodProperties) { object[] parameters = new object[this.methodInfo.GetParameters().Length]; int i = 0; foreach (object propInfo in methodProperties.GetProperties()) { MethodParameterTypeDescriptor param = propInfo as MethodParameterTypeDescriptor; if (param != null) { parameters[i] = param.Value; i++; } } return(this.methodInfo.Invoke(this.Obj, parameters)); }
public PropertyDescriptorCollection GetProperties(Attribute[] attributes) { //PropertyDescriptorCollection baseProps = TypeDescriptor.GetProperties(this.obj, attributes, true); // IList addProps = new ArrayList() ; // // foreach (PropertyDescriptor baseProp in baseProps) // { // IPropertyMap propertyMap = this.ClassMap.GetPropertyMap(baseProp.Name); // if (propertyMap != null) // { // if (propertyMap.ReferenceType == ReferenceType.None) // { // addProps.Add(baseProp); // } // } // } ParameterInfo[] paramInfos = methodInfo.GetParameters() ; if (propertyDescriptorCollection == null) { PropertyDescriptor[] newProps = new PropertyDescriptor[paramInfos.Length]; for (int i = 0; i < paramInfos.Length; i++) { newProps[i] = new MethodParameterTypeDescriptor(this.obj, paramInfos[i], this.methodInfo) ; } propertyDescriptorCollection = new PropertyDescriptorCollection(newProps); } return propertyDescriptorCollection; }