public static string GetContractReference(Type type) { var attribs = type.GetCustomAttributes(false); var helper = new Helper(attribs); var s1 = Optional<string>.Empty; var name = s1 .Combine(() => helper.GetString("ProtoContractAttribute", "Name")) .Combine(() => helper.GetString("DataContractAttribute", "Name")) .Combine(() => helper.GetString("XmlTypeAttribute", "TypeName")) .GetValue(type.Name); var ns = s1 .Combine(() => helper.GetString("DataContractAttribute", "Namespace")) .Combine(() => helper.GetString("XmlTypeAttribute", "Namespace")) .Convert(s => s.Trim() + "/", ""); ns = AppendNesting(ns, type); return ns + name; }
public static string GetContractReference(Type type) { var attribs = type.GetCustomAttributes(false); var helper = new Helper(attribs); var name = Combine( () => helper.GetString("ProtoContractAttribute", "Name"), () => helper.GetString("DataContractAttribute", "Name"), () => helper.GetString("XmlTypeAttribute", "TypeName"), () => type.Name); var ns = Combine( () => helper.GetString("DataContractAttribute", "Namespace"), () => helper.GetString("XmlTypeAttribute", "Namespace")); if (null != ns) { ns = ns.Trim() + '/'; } ns = AppendNesting(ns, type); return ns + name; }