public static void InitFromParentHostCapabilityAttribute(Type definitionType) { var parentHostAttrs = definitionType .GetCustomAttributes(typeof(ParentHostCapabilityAttribute), true) as ParentHostCapabilityAttribute[]; if (parentHostAttrs != null) { foreach (var attr in parentHostAttrs) { if (attr.HostType == null) { continue; } var parentType = attr.HostType; var currentRelationShip = Relationships.FirstOrDefault(r => r.DefinitionType == definitionType); if (currentRelationShip == null) { currentRelationShip = new DefinitionRelationship { DefinitionType = definitionType }; Relationships.Add(currentRelationShip); } if (!currentRelationShip.HostTypes.Contains(parentType)) { currentRelationShip.HostTypes.Add(parentType); } } } }
private static IEnumerable <string> GetUnsupportedRelationshipModelNodeTypes( MethodInfo modelSyntaxMethodInfo, DefinitionRelationship relationships) { if (modelSyntaxMethodInfo == null) { return(Enumerable.Empty <string>()); } var currentInterfaceTypes = modelSyntaxMethodInfo.GetGenericArguments()[0] .GetInterfaces() .Where(i => i != typeof(IHostModelNode)) .ToList(); var currentModelModeTypeNames = AllModelNodeTypes.Where(n => n.GetInterfaces() .Any(i => currentInterfaceTypes.Contains(i))) .Select(t => t.Name); var expectedModelNodeTypeNames = relationships.HostTypes.Select( t => string.Format("{0}ModelNode", t.Name.Replace("Definition", string.Empty))); var unsupportedRelationshipModelNodeTypes = expectedModelNodeTypeNames.Where(i => !currentModelModeTypeNames.Contains(i)); return(unsupportedRelationshipModelNodeTypes); }