本文整理汇总了C#中ObjectType.GetDataTypeLink方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectType.GetDataTypeLink方法的具体用法?C# ObjectType.GetDataTypeLink怎么用?C# ObjectType.GetDataTypeLink使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectType
的用法示例。
在下文中一共展示了ObjectType.GetDataTypeLink方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WalkDescendedValueRoles
/// <summary>
/// Get all value roles including all roles directly attached to the provided
/// object type and any roles descended from this one through prefererred identifiers.
/// Walks the opposite direction of <see cref="Role.GetValueRoles()"/>
/// </summary>
/// <param name="anchorType">The <see cref="ObjectType"/> to walk descended roles for</param>
/// <param name="unattachedRole">A role to test that is not currently attached to the anchorType.
/// If unattachedRole is not null, then only this role will be tested. Otherwise, all current played
/// roles will be walked.</param>
/// <param name="unattachedPreferredIdentifier">A preferred identifier to test that is not currently
/// attached to the anchorType.</param>
/// <param name="visitor">A <see cref="ValueRoleVisitor"/> callback delegate.</param>
public static void WalkDescendedValueRoles(ObjectType anchorType, Role unattachedRole, UniquenessConstraint unattachedPreferredIdentifier, ValueRoleVisitor visitor)
{
ValueTypeHasDataType dataTypeLink = anchorType.GetDataTypeLink();
if (null == unattachedPreferredIdentifier &&
null != (dataTypeLink = anchorType.GetDataTypeLink()))
{
ObjectType unattachedRolePlayer;
WalkDescendedValueRoles(
(unattachedRole != null) ? new Role[] { unattachedRole } as IList<Role> : anchorType.PlayedRoleCollection,
RolePathObjectTypeRoot.GetLinksToRolePathCollection(anchorType),
dataTypeLink,
anchorType.ValueConstraint,
null,
(null == unattachedRole || null == (unattachedRolePlayer = unattachedRole.RolePlayer)) ? false : !unattachedRolePlayer.IsValueType,
visitor);
}
else
{
LinkedElementCollection<Role> roles;
UniquenessConstraint preferredIdentifier;
if (null != (preferredIdentifier = unattachedPreferredIdentifier ?? anchorType.ResolvedPreferredIdentifier) &&
(roles = preferredIdentifier.RoleCollection).Count == 1)
{
Role currentRole = roles[0];
Role[] valueRoles = currentRole.GetValueRoles();
if (valueRoles != null)
{
ValueConstraint nearestValueConstraint = null;
int valueRolesCount = valueRoles.Length;
for (int i = valueRolesCount - 1; i >= 0; --i)
{
nearestValueConstraint = valueRoles[i].ValueConstraint;
if (nearestValueConstraint != null)
{
break;
}
}
ObjectType valueType = valueRoles[0].RolePlayer;
dataTypeLink = valueType.GetDataTypeLink();
if (nearestValueConstraint == null)
{
nearestValueConstraint = valueType.ValueConstraint;
}
RoleBase nextSkipRole = currentRole.OppositeRoleAlwaysResolveProxy;
if (nextSkipRole != null)
{
WalkDescendedValueRoles(
(unattachedRole != null) ? new Role[] { unattachedRole } as IList<Role> : anchorType.PlayedRoleCollection,
RolePathObjectTypeRoot.GetLinksToRolePathCollection(anchorType),
dataTypeLink,
nearestValueConstraint,
nextSkipRole.Role,
true,
visitor);
}
}
}
}
}