/// <summary> Determines an attribute string for the given instance reference. </summary> private string ReferenceToString(object tempValue, out bool reference) { reference = true; if (tempValue == null) { return(String.Empty); } else { Type type = tempValue.GetType(); PublishNameAttribute attribute = ((PublishNameAttribute)ReflectionUtility.GetAttribute(type, typeof(PublishNameAttribute))); if (attribute != null) { return((string)ReflectionUtility.GetMemberValue(ReflectionUtility.FindSimpleMember(type, attribute.MemberName), tempValue)); } else { var converter = Persistence.GetTypeConverter(type); if (converter != null) { reference = false; return(converter.ConvertToString(tempValue)); } } return(String.Empty); } }
/// <summary> Determines the member name that is designated as the bop:name for the type. </summary> protected static string GetNameMemberName(MemberInfo member) { PublishNameAttribute attribute = (PublishNameAttribute)ReflectionUtility.GetAttribute(member, typeof(PublishNameAttribute)); if (attribute == null) { return(String.Empty); } return(attribute.MemberName); }
/// <summary> Gets the MemberInfo for the name member of the specified type. </summary> private MemberInfo GetNameMemberInfo(Type type) { PublishNameAttribute publishName = (PublishNameAttribute)ReflectionUtility.GetAttribute(type, typeof(PublishNameAttribute)); if (publishName == null) { return(null); } else { return(ReflectionUtility.FindSimpleMember(type, publishName.MemberName)); } }