internal WorkItemWrapper(EngineContext context, WorkItem item) { _context = context; _item = item; _relationCollection = new WorkItemRelationWrapperCollection(this, _item.Relations); if (item.Id.HasValue) { Id = new PermanentWorkItemId(item.Id.Value); Changes.Add(new JsonPatchOperation() { Operation = Operation.Test, Path = "/rev", Value = item.Rev }); _context.Tracker.TrackExisting(this); } else { Id = new TemporaryWorkItemId(_context.Tracker); Changes.Add(new JsonPatchOperation() { Operation = Operation.Add, Path = "/id", Value = Id.Value }); _context.Tracker.TrackNew(this); } }
internal WorkItemWrapper(EngineContext context, WorkItem item) { _context = context; _item = item; _originalValues = new Dictionary <string, object>(item.Fields); Relations = new WorkItemRelationWrapperCollection(this, _item.Relations); if (item.Id.HasValue) { Id = new PermanentWorkItemId(item.Id.Value); AddRevisionCheck(item, context); //for simplify testing: item.Url can be null IsDeleted = item.Url?.EndsWith($"/recyclebin/{item.Id.Value}", StringComparison.OrdinalIgnoreCase) ?? false; IsReadOnly = false; _context.Tracker.TrackExisting(this); } else { Id = new TemporaryWorkItemId(_context.Tracker); Changes.Add(new JsonPatchOperation() { Operation = Operation.Add, Path = "/id", Value = Id.Value }); _context.Tracker.TrackNew(this); } }
internal WorkItemWrapper(EngineContext context, WorkItem item) { _context = context.Track(this); if (item.Id.HasValue) { Id = new PermanentWorkItemId(item.Id.Value); Changes.Add(new JsonPatchOperation() { Operation = Operation.Test, Path = "/rev", Value = item.Rev }); } else { Id = new TemporaryWorkItemId(); Changes.Add(new JsonPatchOperation() { Operation = Operation.Test, Path = "/id", Value = Id }); } _item = item; }
public WorkItemWrapper(EngineContext context, WorkItemWrapper template, string type) { _context = context.Track(this); Id = new TemporaryWorkItemId(); _item = new WorkItem(); _item.Fields[CoreFieldRefNames.TeamProject] = template.TeamProject; _item.Fields[CoreFieldRefNames.WorkItemType] = type; _item.Fields[CoreFieldRefNames.Id] = Id.Value; Changes.Add(new JsonPatchOperation() { Operation = Operation.Test, Path = "/id", Value = Id }); }
public WorkItemWrapper(EngineContext context, WorkItemWrapper template, string type) { _context = context; Id = new TemporaryWorkItemId(_context.Tracker); _item = new WorkItem(); _item.Fields[CoreFieldRefNames.TeamProject] = template.TeamProject; _item.Fields[CoreFieldRefNames.WorkItemType] = type; _item.Fields[CoreFieldRefNames.Id] = Id.Value; _relationCollection = new WorkItemRelationWrapperCollection(this, _item.Relations); Changes.Add(new JsonPatchOperation() { Operation = Operation.Add, Path = "/id", Value = Id.Value }); _context.Tracker.TrackNew(this); }