private static bool HasPartType(object bean, string part) { bool result = false; if (bean.GetType().IsAnnotationPresent(typeof(Hl7PartTypeMappingAttribute))) { Hl7PartTypeMappingAttribute partType = bean.GetType().GetAnnotation <Hl7PartTypeMappingAttribute>(); string[] values = partType.Value; result = values.Length > 0 && values[0].Equals(part); } return(result); }
private static Hl7PartTypeMappingAttribute GetClassAttributes(Type type, Type attributeType) { var classAttributes = type.GetCustomAttributes(attributeType, false); Hl7PartTypeMappingAttribute attr = null; if (classAttributes.Length > 0) { attr = classAttributes[0] as Hl7PartTypeMappingAttribute; } return(attr); }