本文整理汇总了C#中IEditableRoot.GetAncestor方法的典型用法代码示例。如果您正苦于以下问题:C# IEditableRoot.GetAncestor方法的具体用法?C# IEditableRoot.GetAncestor怎么用?C# IEditableRoot.GetAncestor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEditableRoot
的用法示例。
在下文中一共展示了IEditableRoot.GetAncestor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public static IFieldOptions Create(PropertyInfo property, IEditableRoot editableRoot)
{
if (property == null)
{
throw new ArgumentNullException("property");
}
if (editableRoot == null)
{
throw new ArgumentNullException("editableRoot");
}
var crossRefAttr = property.GetCustomAttributes(typeof(CrossRefFieldAttribute), false).Select(d => d).FirstOrDefault() as CrossRefFieldAttribute;
if (crossRefAttr == null)
{
throw new VeyronException("CrossRef attribute not found on Cross-reference field property");
}
string valueAsText = "Unknown";
var crId = editableRoot.GetValueByPropertyName(property.Name) as int?;
if (crId.HasValue)
{
var ancestor = editableRoot.GetAncestor(property);
if (ancestor != null)
{
var crItem = DynamicTypeManager.Instance.GetCrossReferenceItem(ancestor.ProcessName, property.Name, crId.Value);
if (crItem != null)
{
valueAsText = crItem.GetValueByPropertyName(crossRefAttr.RefFieldName) == null ? "Unknown" : crItem.GetValueByPropertyName(crossRefAttr.RefFieldName).ToString();
}
}
}
var result = new SingleCrossRefFieldOptions
{
ValueAsText = valueAsText,
ProcessSystemName = crossRefAttr.ReferenceTableName,
FieldName = crossRefAttr.RefFieldName,
AllowViewDetail = crossRefAttr.AllowViewDetail,
AllowClear = crossRefAttr.AllowClear
};
return result;
}