private static void AppendMember(StringBuilder text, IConceptInfo ci, ConceptMember member, bool exceptionOnNullMember) { object memberValue = member.GetValue(ci); if (memberValue == null) { if (exceptionOnNullMember) { throw new DslSyntaxException(ci, string.Format( "{0}'s property {1} is null. Info: {2}.", ci.GetType().Name, member.Name, ci.GetErrorDescription())); } else { text.Append("<null>"); } } else if (member.IsConceptInfo) { IConceptInfo value = (IConceptInfo)member.GetValue(ci); if (member.ValueType == typeof(IConceptInfo)) { text.Append(BaseConceptInfoType(value).Name).Append(":"); } AppendMembers(text, value, SerializationOptions.KeyMembers, exceptionOnNullMember); } else if (member.ValueType == typeof(string)) { text.Append(SafeDelimit(member.GetValue(ci).ToString())); } else { throw new FrameworkException(string.Format( "IConceptInfo member {0} of type {1} in {2} is not supported.", member.Name, member.ValueType.Name, ci.GetType().Name)); } }
private static void AppendMember(StringBuilder text, IConceptInfo ci, ConceptMember member, bool exceptionOnNullMember) { object memberValue = member.GetValue(ci); if (memberValue == null) if (exceptionOnNullMember) throw new DslSyntaxException(ci, string.Format( "{0}'s property {1} is null. Info: {2}.", ci.GetType().Name, member.Name, ci.GetErrorDescription())); else text.Append("<null>"); else if (member.IsConceptInfo) { IConceptInfo value = (IConceptInfo)member.GetValue(ci); if (member.ValueType == typeof(IConceptInfo)) text.Append(BaseConceptInfoType(value).Name).Append(":"); AppendMembers(text, value, SerializationOptions.KeyMembers, exceptionOnNullMember); } else if (member.ValueType == typeof(string)) text.Append(SafeDelimit(member.GetValue(ci).ToString())); else throw new FrameworkException(string.Format( "IConceptInfo member {0} of type {1} in {2} is not supported.", member.Name, member.ValueType.Name, ci.GetType().Name)); }