internal RelatedLink(int related, [CanBeNull] IWorkItemLinkTypeEnd linkTypeEnd = null, [CanBeNull] string comment = null) : base(comment, BaseLinkType.RelatedLink) { RelatedWorkItemId = related; LinkTypeEnd = linkTypeEnd; }
internal void SetForwardEnd(IWorkItemLinkTypeEnd value) { if (_forward != null) { throw new InvalidOperationException($"{nameof(ForwardEnd)} already contains a value.".ToString(CultureInfo.InvariantCulture)); } _forward = value ?? throw new ArgumentNullException(nameof(value)); }
public MockRelatedLink(IWorkItemLinkTypeEnd linkTypeEnd, int sourceId, int targetId) : base(targetId, linkTypeEnd) { if (sourceId == targetId) { throw new ArgumentException($"Parameter {nameof(sourceId)} cannot be the same as {nameof(targetId)}."); } LinkInfo = new WorkItemLinkInfo(sourceId, targetId, linkTypeEnd); }
/// <summary> /// Safes the write identifier. /// </summary> /// <param name="workItemLinkTypeEnd">The work item link type end.</param> /// <returns>String.</returns> private static String SafeWriteId(IWorkItemLinkTypeEnd workItemLinkTypeEnd) { try { return(String.Format("{0}", workItemLinkTypeEnd.Id)); } catch (Exception ex) { return(String.Format("{0}:{1}", ex.GetType().Name, ex.Message)); } }
internal WorkItemLinkType([NotNull] string referenceName, [NotNull] IWorkItemLinkTypeEnd forward, [NotNull] IWorkItemLinkTypeEnd reverse) : this(referenceName) { Contract.Requires(!string.IsNullOrEmpty(referenceName)); Contract.Requires(forward != null); Contract.Requires(reverse != null); _forward = forward ?? throw new ArgumentNullException(nameof(forward)); _reverse = reverse ?? throw new ArgumentNullException(nameof(reverse)); _forwardFac = null; _reverseFac = null; }
public override IRelatedLink CreateRelatedLink(int id, IWorkItemLinkTypeEnd linkTypeEnd = null) { if (IsNew) { throw new InvalidOperationException("Save first"); } if (id != 0 && linkTypeEnd == null) { throw new ArgumentException($"Value cannot be zero when no {nameof(IWorkItemLinkTypeEnd)} specified.", nameof(id)); } if (id == 0 && linkTypeEnd == null) { return(new MockRelatedLink(null, Id)); } return(new MockRelatedLink(linkTypeEnd, Id, id)); }
/// <summary> /// Gets the Id from the specified <paramref name="item"/>. /// </summary> /// <param name="item">An instance of <see cref="IWorkItemLinkTypeEnd"/>.</param> /// <returns> /// 0 if <paramref name="item"/> is null or the <see cref="M:IWorkItemLinkTypeEnd.LinkType"/> is null; otherwise the link type id. /// </returns> /// <remarks> /// A true Id is only returned for SOAP instances of <paramref name="item"/> /// </remarks> public static int LinkTypeId(this IWorkItemLinkTypeEnd item) { // No link type. In SOAP this is equivilent to SELF and has a constant id of 0 if (item == null) { return(0); } // In SOAP, the IWorkItemLinkTypeEnd is IIdentifiable<int>. Try to cast and return the Id if (item is IIdentifiable <int> i) { return(i.Id); } // Same as initial case--no link type. if (item.LinkType == null) { return(0); } // Hack for REST: If there is an immutable name, get a case-insensitive hash if (!string.IsNullOrEmpty(item.ImmutableName)) { var hash = Math.Abs(StringComparer.OrdinalIgnoreCase.GetHashCode(item.ImmutableName)); // Forward links are ALWAYS a positive value if (item.IsForwardLink) { return(hash); } // Reverse links are ALWAYS a negative value return(hash * -1); } return(0); }
partial void ReverseEnd_SetCondition(ref IWorkItemLinkType instance, ref IWorkItemLinkTypeEnd setValue);
partial void ForwardEnd_SetCondition(ref IWorkItemLinkType instance, ref IWorkItemLinkTypeEnd setValue);
public IRelatedLink CreateRelatedLink(IWorkItemLinkTypeEnd linkTypeEnd, IWorkItem relatedWorkItem) { throw new NotImplementedException(); }
internal WorkItemLinkInfo(int sourceId, int targetId, [CanBeNull] IWorkItemLinkTypeEnd linkTypeEnd) { SourceId = sourceId; TargetId = targetId; _linkTypeEnd = linkTypeEnd; }
public static WorkItemLinkTypeEnd Map(WorkItemStore store, IWorkItemLinkTypeEnd end) { var linkType = store.WorkItemLinkTypes.Single(type => type.ReferenceName == end.LinkType.ReferenceName); return(end.IsForwardLink ? linkType.ForwardEnd : linkType.ReverseEnd); }
partial void IsForwardLink_SetCondition(ref IWorkItemLinkTypeEnd instance, ref Boolean setValue);
private IWorkItemLinkTypeEnd CoerceForwardValue() { return(_forward ?? (_forward = _forwardFac.Value)); }
/// <inheritdoc /> internal WorkItemLinkInfo(int sourceId, int targetId, int linkTypeId, [CanBeNull] IWorkItemLinkTypeEnd linkTypeEnd) : base(sourceId, targetId, linkTypeEnd) { Id = linkTypeId; }
public MockRelatedLink(IWorkItemLinkTypeEnd linkTypeEnd) : base(0, linkTypeEnd) { LinkInfo = new WorkItemLinkInfo(0, 0, linkTypeEnd); }
/// <summary> /// Tries the name of the get by. /// </summary> /// <param name="linkTypeEndName">End name of the link type.</param> /// <param name="linkTypeEnd">The link type end.</param> /// <returns>Boolean.</returns> /// <exception cref="DynCon.OSI.Core.Helpers.ToBeImplementedException"></exception> Boolean IWorkItemLinkTypeEndCollection.TryGetByName(String linkTypeEndName, out IWorkItemLinkTypeEnd linkTypeEnd) { throw new ToBeImplementedException(); }
/// <summary> /// Tries the get by identifier. /// </summary> /// <param name="id">The identifier.</param> /// <param name="linkTypeEnd">The link type end.</param> /// <returns>Boolean.</returns> /// <exception cref="DynCon.OSI.Core.Helpers.ToBeImplementedException"></exception> Boolean IWorkItemLinkTypeEndCollection.TryGetById(Int32 id, out IWorkItemLinkTypeEnd linkTypeEnd) { throw new ToBeImplementedException(); }
public IRelatedLink CreateRelatedLink(IWorkItemLinkTypeEnd linkTypeEnd, IWorkItem relatedWorkItem) { var rawLinkTypeEnd = LinkTypeEndMapper.Map(_item.Store, linkTypeEnd); return(ExceptionHandlingDynamicProxyFactory.Create <IRelatedLink>(new RelatedLinkProxy(new Tfs.RelatedLink(rawLinkTypeEnd, relatedWorkItem.Id)))); }
partial void LinkTypeEnd_SetCondition(ref IRelatedLink instance, ref IWorkItemLinkTypeEnd setValue);
partial void OppositeEnd_SetCondition(ref IWorkItemLinkTypeEnd instance, ref IWorkItemLinkTypeEnd setValue);
partial void ImmutableName_SetCondition(ref IWorkItemLinkTypeEnd instance, ref String setValue);
private IWorkItemLinkTypeEnd CoerceReverseValue() { return(_reverse ?? (_reverse = _reverseFac.Value)); }
internal static Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemLinkTypeEnd Map(Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore store, IWorkItemLinkTypeEnd end) { var linkType = store.WorkItemLinkTypes.Single(type => type.ReferenceName == end.LinkType.ReferenceName); return(end.IsForwardLink ? linkType.ForwardEnd : linkType.ReverseEnd); }
public MockRelatedLink(IWorkItemLinkTypeEnd linkTypeEnd, int targetId) : base(targetId, linkTypeEnd) { LinkInfo = new WorkItemLinkInfo(0, targetId, linkTypeEnd); }