internal static PolyLink Create(LinkDef link) { return(new PolyLink { Direction = link.Direction.Value, From = link.From.Value, To = link.To.Value, }); }
/// <summary> /// Gets the references. /// </summary> /// <param name="context">The context.</param> /// <returns></returns> public virtual System.Collections.Generic.IEnumerable <ReferenceItem> GetReferences(ReferenceContext context) { // Liste des références externes à partir de cette couche if (context.Scope != ReferenceScope.Publish) { // Sockage temporaire du lien entre le composant externe et ses ports utilisés Dictionary <ExternalComponent, LinkDef> candidates = new Dictionary <ExternalComponent, LinkDef>(); IList <ExternalServiceReference> externalServiceLinks = ExternalServiceReference.GetLinksToExternalServiceReferences(this); foreach (ExternalServiceReference link in externalServiceLinks) { if (context.Mode.CheckConfigurationMode(link.ConfigurationMode)) { if (context.Scope == ReferenceScope.All || ( ((context.Scope == ReferenceScope.Runtime && !link.ExternalPublicPort.IsInGac) || context.Scope == ReferenceScope.Compilation) && context.CheckScope(link.Scope)) ) { LinkDef def; if (!candidates.TryGetValue(link.ExternalPublicPort.Parent, out def)) { def.Ports = new List <Guid>(); def.Scope = link.Scope; candidates.Add(link.ExternalPublicPort.Parent, def); } def.Ports.Add(link.ExternalPublicPort.ComponentPortMoniker); } } } foreach (ExternalComponent externalComponent in candidates.Keys) { LinkDef def = candidates[externalComponent]; ReferenceItem ri = new ReferenceItem(this, externalComponent, def.Scope, def.Ports, context.IsExternal); yield return(ri); } } // Liste des artifacts IList <LayerHasArtifacts> artifactsLinks = LayerHasArtifacts.GetLinksToArtifacts(this); foreach (LayerHasArtifacts link in artifactsLinks) { if (context.Mode.CheckConfigurationMode(link.Artifact.ConfigurationMode) && context.CheckScope(link.Artifact.Scope)) { yield return(new ReferenceItem(this, link.Artifact, link.Artifact.Scope, context.IsExternal)); } } }