Aras学习笔记 (39) 根据Related Id查询Source Item列表的通用方法
这篇和 Aras学习笔记 (35) 根据Source Id提取关联Related Item列表的通用方法 类似,是通过related_id来查询过滤source item列表。
/// <summary> /// 根据Related Id查询Source Item列表 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="SourceItemTypeName"></param> /// <param name="RelationshipItemTypeName"></param> /// <param name="RelatedItemTypeName"></param> /// <param name="RelatedId"></param> /// <returns></returns> public List<T> GetListByRelatedId<T>(string SourceItemTypeName, string RelationshipItemTypeName, string RelatedItemTypeName, string RelatedId) { List<T> list = new List<T>(); string aml = @"<AML> <Item type='{0}' action='get'> <related_id> <Item type='{1}' action='get'> <id>{2}</id> </Item> </related_id> <source_id> <Item type='{3}' action='get'> </Item> </source_id> </Item> </AML>"; if (innovator != null) { Item item = innovator.applyAML(string.Format(aml, RelationshipItemTypeName, RelatedItemTypeName, RelatedId, SourceItemTypeName)); if (item != null) { if (item.node != null || item.nodeList != null) { ModelHelper helper = new ModelHelper(); list = helper.GetModelListFromXml<T>(item.dom.InnerXml, "source_id"); } } } return list; }