本文整理汇总了C#中CodeType.VisibleMembers方法的典型用法代码示例。如果您正苦于以下问题:C# CodeType.VisibleMembers方法的具体用法?C# CodeType.VisibleMembers怎么用?C# CodeType.VisibleMembers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CodeType
的用法示例。
在下文中一共展示了CodeType.VisibleMembers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetRelatedEntities
public IEnumerable<RelatedEntityInfo> GetRelatedEntities(CodeType codeType, Project project, IProjectTypeLocator projectTypeLocator)
{
var thisEntityPrimaryKeys = PrimaryKeyLocation.GetPrimaryKeys(codeType).ToList();
var propertiesToConsider = (from property in codeType.VisibleMembers().OfType<CodeProperty>()
where ((CodeElement)property).IsPublic()
&& !thisEntityPrimaryKeys.Contains(property) // Exclude its own primary keys, otherwise it will always be related to itself
select property).ToList();
foreach (var property in propertiesToConsider) {
var relatedEntityInfo = GetRelatedParentEntityInfo(property, propertiesToConsider, project, projectTypeLocator)
?? GetRelatedChildEntityInfo(property, project, projectTypeLocator);
if (relatedEntityInfo != null)
yield return relatedEntityInfo;
}
}
示例2: GetPrimaryKeys
public static IEnumerable<CodeProperty> GetPrimaryKeys(CodeType codeType)
{
var membersToConsider = codeType.VisibleMembers();
return membersToConsider.OfType<CodeProperty>().Where(x => IsPrimaryKey(x.Parent, x)).ToList();
}