public PocoFeatureAttributeDefinition(PropertyInfo propertyInfo, FeatureAttributeAttribute att) { AttributeName = propertyInfo.Name; if (!string.IsNullOrEmpty(att.AttributeName)) AttributeName = att.AttributeName; AttributeDescription = att.AttributeDescription; AttributeType = propertyInfo.PropertyType; if (propertyInfo.CanRead) { _getMethod = propertyInfo.GetGetMethod(); _static = _getMethod.IsStatic; } if (propertyInfo.CanWrite) { _setMethod = propertyInfo.GetSetMethod(); } else { _readonly = true; } /* var att = propertyInfo.GetCustomAttributes(typeof (FeatureAttributeAttribute), true); if (att.Length > 0) CorrectByAttribute((FeatureAttributeAttribute)att[0]); */ CorrectByAttribute(att); }
public void CorrectByAttribute(FeatureAttributeAttribute attribute) { if (attribute.Ignore) { Ignore = true; return; } if (!string.IsNullOrEmpty(attribute.AttributeName)) AttributeName = attribute.AttributeName; if (!string.IsNullOrEmpty(attribute.AttributeName)) AttributeName = attribute.AttributeName; _readonly |= attribute.Readonly; Ignore = attribute.Ignore; }