コード例 #1
0
        private RTArtifactLink FindCreateLink(ILink link, RuntimeEntityModel context)
        {
            var rtLink = context.FindArtifactLink(
                link.SourceArtifactId,
                link.SourceArtifact.Uri,
                link.TargetArtifact.Uri,
                link.Comment,
                link.LinkType.ReferenceName,
                link.LinkType.FriendlyName,
                GetExtendedPropertyString(link),
                link.LinkType.SourceArtifactType.ReferenceName,
                link.LinkType.SourceArtifactType.FriendlyName,
                link.LinkType.SourceArtifactType.ContentTypeReferenceName,
                link.LinkType.TargetArtifactType.ReferenceName,
                link.LinkType.TargetArtifactType.FriendlyName,
                link.LinkType.TargetArtifactType.ContentTypeReferenceName,
                true
                ).First();

            rtLink.IsLocked = link.IsLocked;
            return(rtLink);

            //var rtArtifactLink = RTArtifactLink.CreateRTArtifactLink(0, link.SourceArtifact.Uri, link.TargetArtifact.Uri);
            //rtArtifactLink.Comment = link.Comment;
            //rtArtifactLink.SourceArtifactId = link.SourceArtifactId;

            //var rtLinkTypeId = FindCreateLinkType(link.LinkType);

            //var rtLinkType = context.RTLinkTypeSet.Where(lt => lt.Id == rtLinkTypeId).First();
            //Debug.Assert(null != rtLinkType);

            //rtArtifactLink.LinkType = rtLinkType;
            //return rtArtifactLink;
        }