当前位置:Gxlcms > mysql > [tfs]workitemtrackingsourcecode

[tfs]workitemtrackingsourcecode

时间:2021-07-01 10:21:17 帮助过:97人阅读

在编程时经常会遇到一些错误,例如,http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.workitemtracking.client.fieldstatus.aspx 上面所列出的错误,简单的通过描述无法确认真的问题所在,那么你就需要查看server内部是如何实现的。 names

在编程时经常会遇到一些错误,例如,http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.workitemtracking.client.fieldstatus.aspx 上面所列出的错误,简单的通过描述无法确认真的问题所在,那么你就需要查看server内部是如何实现的。
namespaceMicrosoft.TeamFoundation.WorkItemTracking.Client { usingMicrosoft.TeamFoundation; usingMicrosoft.TeamFoundation.Client; usingMicrosoft.TeamFoundation.Common; usingMicrosoft.TeamFoundation.WorkItemTracking.Client.DataStore; usingMicrosoft.TeamFoundation.WorkItemTracking.Proxy; usingSystem; usingSystem.Collections; usingSystem.Collections.Generic; usingSystem.Globalization; usingSystem.IO; usingSystem.Reflection; usingSystem.Runtime.InteropServices; usingSystem.Threading; usingSystem.Xml; publicsealed classWorkItem : IRevisionInternal { internalconst intc_revisionHistory = -4; internalconst intc_revisionLatest = -3; internalconst intc_revisionNull = -1; internalconst intc_revisionUpdate = -2; privateDateTime? m_asof; privateAttachmentCollection m_attachments; privateint m_dataVersion; privatebool? m_dirty; privateFieldCollection m_fields; privateWorkItemFieldData m_fieldsData; privateint m_id; privateint m_index; privatebool m_IsUpdating; privateLinkCollection m_links; privateWorkItemLinkData m_linksData; privateWorkItemCollection m_list; privateint m_metadataVersion; privateOpenState m_openState; privateMicrosoft.TeamFoundation.WorkItemTracking.Client.Project m_project; privatebool? m_readonly; privateRevisionCollection m_revisions; privateWorkItemStore m_store; privateint m_tempId; privateWorkItemType m_type; privateWorkItemLinkCollection m_wlinks; privateWorkItemLinkCollection m_wlinksHistory; privatestatic int[] s_areaDependentFieldIds =new int[] { -12, -42, -43, -44, -45, -46, -47, -48, -49 }; internalstatic int[] s_internallyCalculatedFieldIds =new int[] { -7, -12, -42, -43, -44, -45, -46, -47, -48, -49, -105, -50, -51, -52, -53, -54, -55, -56 }; privatestatic int[] s_iterationDependentFieldIds =new int[] { -50, -51, -52, -53, -54, -55, -56 }; privatestatic ints_tempId = 0; publicevent WorkItemFieldChangeEventHandler FieldChanged; publicWorkItem(WorkItemType type) { this.m_dirty =false; this.m_readonly =null; this.m_asof =null; Microsoft.TeamFoundation.Common.Marker.Process(Microsoft.TeamFoundation.Common.Mark.OMWorkItemNewBegin); TeamFoundationTrace.Verbose("Entering WorkItem(WorkItemStore store, WorkItemType type)"); if(type == null) { thrownew ArgumentNullException("type"); } this.m_fieldsData =new WorkItemFieldData(this); this.m_linksData =new WorkItemLinkData(this); this.m_store = type.Store; this.m_id = 0; this.m_tempId = Interlocked.Decrement(refs_tempId); this.m_openState = OpenState.New; this.m_readonly =false; this.InitNew(type); this.ApplyRules(); this.m_dirty =true; Microsoft.TeamFoundation.Common.Marker.Process(Microsoft.TeamFoundation.Common.Mark.OMWorkItemNewEnd); } internalWorkItem(WorkItemCollection list, intindex) { this.m_dirty =false; this.m_readonly =null; this.m_asof =null; this.m_store = list.Store; this.m_fieldsData =new WorkItemFieldData(this); this.m_linksData =new WorkItemLinkData(this); this.m_id = list.GetId(index); this.m_tempId =this.m_id; this.m_list = list; this.m_index = index; this.m_openState = OpenState.Queried; if(!list.Query.IsBatchReadMode) { this.m_asof =new DateTime?(list.Query.AsOfUTC); } } internalWorkItem(WorkItemStore store, intid) { this.m_dirty =false; this.m_readonly =null; this.m_asof =null; Microsoft.TeamFoundation.Common.Marker.Process(Microsoft.TeamFoundation.Common.Mark.OMWorkItemNewBegin); TeamFoundationTrace.Verbose("Entering WorkItem(WorkItemStore store, int id)"); if(store == null) { thrownew ArgumentNullException("store"); } if(id <= 0) { thrownew ArgumentOutOfRangeException("id"); } this.m_store = store; this.m_fieldsData =new WorkItemFieldData(this); this.m_linksData =new WorkItemLinkData(this); this.m_id = id; this.m_tempId = id; this.LoadWorkItem(id, 0,null); this.ApplyRules(); Microsoft.TeamFoundation.Common.Marker.Process(Microsoft.TeamFoundation.Common.Mark.OMWorkItemNewEnd); } internalWorkItem(WorkItemStore store, System.Uri uri) { this.m_dirty =false; this.m_readonly =null; this.m_asof =null; Microsoft.TeamFoundation.Common.Marker.Process(Microsoft.TeamFoundation.Common.Mark.OMWorkItemNewBegin); TeamFoundationTrace.Verbose("Entering WorkItem(WorkItemStore store, Uri uri)"); if(store == null) { thrownew ArgumentNullException("store"); } this.m_store = store; this.m_fieldsData =new WorkItemFieldData(this); this.m_linksData =new WorkItemLinkData(this); if(!this.IsValidUri(uri)) { thrownew ArgumentException("uri"); } ArtifactId artifact =this.GetArtifact(uri); this.m_id = Convert.ToInt32(artifact.ToolSpecificId, CultureInfo.InvariantCulture); this.m_tempId =this.m_id; this.LoadWorkItem(this.m_id, 0,null); this.ApplyRules(); Microsoft.TeamFoundation.Common.Marker.Process(Microsoft.TeamFoundation.Common.Mark.OMWorkItemNewEnd); } internalWorkItem(WorkItemStore store, intid, DateTime at) { this.m_dirty =false; this.m_readonly =null; this.m_asof =null; Microsoft.TeamFoundation.Common.Marker.Process(Microsoft.TeamFoundation.Common.Mark.OMWorkItemNewBegin); TeamFoundationTrace.Verbose("Entering WorkItem(WorkItemStore store, int id, DateTime at)"); if(store == null) { thrownew ArgumentNullException("store"); } if(id <= 0) { thrownew ArgumentOutOfRangeException("id"); } DateTime time = store.ConvertToUniversalTime(at); if((time < newDateTime(0x76c, 1, 1)) || (time >= DateTime.MaxValue)) { thrownew ArgumentOutOfRangeException("at"); } this.m_store = store; this.m_fieldsData =new WorkItemFieldData(this); this.m_linksData =new WorkItemLinkData(this); this.m_id = id; this.m_tempId = id; this.LoadWorkItem(id, 0,new DateTime?(time)); this.ApplyRules(); Microsoft.TeamFoundation.Common.Marker.Process(Microsoft.TeamFoundation.Common.Mark.OMWorkItemNewEnd); } internalWorkItem(WorkItemStore store, intid, int revision) { this.m_dirty =false; this.m_readonly =null; this.m_asof =null; Microsoft.TeamFoundation.Common.Marker.Process(Microsoft.TeamFoundation.Common.Mark.OMWorkItemNewBegin); TeamFoundationTrace.Verbose("Entering WorkItem(WorkItemStore store, int id, int revision)"); if(store == null) { thrownew ArgumentNullException("store"); } if(id <= 0) { thrownew ArgumentOutOfRangeException("id"); } if(revision <= 0) { thrownew ArgumentOutOfRangeException("revision"); } this.m_store = store; this.m_fieldsData =new WorkItemFieldData(this); this.m_linksData =new WorkItemLinkData(this); this.m_id = id; this.m_tempId = id; this.LoadWorkItem(id, revision,null); this.ApplyRules(); Microsoft.TeamFoundation.Common.Marker.Process(Microsoft.TeamFoundation.Common.Mark.OMWorkItemNewEnd); } internalWorkItem(WorkItemStore store, System.Uri uri, DateTime at) { this.m_dirty =false; this.m_readonly =null; this.m_asof =null; Microsoft.TeamFoundation.Common.Marker.Process(Microsoft.TeamFoundation.Common.Mark.OMWorkItemNewBegin); TeamFoundationTrace.Verbose("Entering WorkItem(WorkItemStore store, Uri uri, DateTime at)"); if(store == null) { thrownew ArgumentNullException("store"); } DateTime time = store.ConvertToUniversalTime(at); if((time < newDateTime(0x76c, 1, 1)) || (time >= DateTime.MaxValue)) { thrownew ArgumentOutOfRangeException("at"); } this.m_store = store; this.m_fieldsData =new WorkItemFieldData(this); this.m_linksData =new WorkItemLinkData(this); if(!this.IsValidUri(uri)) { thrownew ArgumentException("uri"); } ArtifactId artifact =this.GetArtifact(uri); this.m_id = Convert.ToInt32(artifact.ToolSpecificId, CultureInfo.InvariantCulture); this.m_tempId =this.m_id; this.LoadWorkItem(this.m_id, 0,new DateTime?(time)); this.ApplyRules(); Microsoft.TeamFoundation.Common.Marker.Process(Microsoft.TeamFoundation.Common.Mark.OMWorkItemNewEnd); } internalWorkItem(WorkItemStore store, System.Uri uri, intrevision) { this.m_dirty =false; this.m_readonly =null; this.m_asof =null; Microsoft.TeamFoundation.Common.Marker.Process(Microsoft.TeamFoundation.Common.Mark.OMWorkItemNewBegin); TeamFoundationTrace.Verbose("Entering WorkItem(WorkItemStore store, Uri uri, int revision)"); if(store == null) { thrownew ArgumentNullException("store"); } if(revision <= 0) { thrownew ArgumentOutOfRangeException("revision"); } this.m_store = store; this.m_fieldsData =new WorkItemFieldData(this); this.m_linksData =new WorkItemLinkData(this); if(!this.IsValidUri(uri)) { thrownew ArgumentException("uri"); } ArtifactId artifact =this.GetArtifact(uri); this.m_id = Convert.ToInt32(artifact.ToolSpecificId, CultureInfo.InvariantCulture); this.m_tempId =this.m_id; this.LoadWorkItem(this.m_id, revision,null); this.ApplyRules(); Microsoft.TeamFoundation.Common.Marker.Process(Microsoft.TeamFoundation.Common.Mark.OMWorkItemNewEnd); } internalvoid ApplyFieldChange(intfieldId, objectvalue) { BrieCallBack bc =new BrieCallBack(this); WorkItemFieldData.FieldUpdate update =new WorkItemFieldData.FieldUpdate(); update.Value = value; update.Flags = 0; bc.FieldUpdates.Add(fieldId, update); this.ApplyFieldChange(fieldId, bc, 2); bc.FieldUpdates.Remove(fieldId); this.FieldData.SetFieldValues(bc.FieldUpdates); this.Store.PsDatastore.BrieAccessCheck(bc, 1, fieldId); this.FieldData.SetFieldStates(bc.FieldStates); } privatevoid ApplyFieldChange(intfieldId, BrieCallBack bc, intrecursive) { if(fieldId != 0) { this.Store.PsDatastore.BrieInvalidateFields(bc, fieldId); bc.SetFieldUpdateFlags(WorkItemFieldData.FieldFlags.SetByDefaultRule); this.Store.PsDatastore.BrieAccessCheck(bc, 0x80, fieldId); bc.SetFieldUpdateFlags(0); this.Store.PsDatastore.BrieAccessCheck(bc, 0x40, fieldId); } Dictionary<int,bool=""> dictionary = bc.ResetChanges(); if(recursive > 0) { foreach(int num in dictionary.Keys) { this.ApplyFieldChange(num, bc, recursive - 1); } } } internalvoid ApplyRules() { this.ApplyRules(true); } internalvoid ApplyRules(boolfSetChangedBy) { this.FieldData.ResetChangedFields(); BrieCallBack callback =new BrieCallBack(this); callback.SetFieldUpdateFlags(WorkItemFieldData.FieldFlags.SetByDefaultRule); this.Store.PsDatastore.BrieAccessCheck(callback, 0x80, 0); callback.SetFieldUpdateFlags(0); this.Store.PsDatastore.BrieAccessCheck(callback, 0x20, 0); this.ApplyFieldChange(0, callback, 2); this.FieldData.SetFieldValues(callback.FieldUpdates); this.Store.PsDatastore.BrieAccessCheck(callback, 1, 0); this.FieldData.SetAllFieldStates(callback.FieldStates); if(fSetChangedBy) { intid = 9; stringuserDisplayName = this.m_store.UserDisplayName; if(this.FieldData.SetUpdateFieldValue(id, userDisplayName, WorkItemFieldData.FieldFlags.SetByRule)) { this.ApplyFieldChange(id, userDisplayName); } } this.FieldData.FireEvents(); } privateobject CalculateAuthorizedAsField(intrevision) { objectfieldValue = this.GetFieldValue(-6, revision); if(fieldValue isint) { returnthis.m_store.GetPersonNameById((int) fieldValue); } returnfieldValue; } internalvoid CalculateFieldLists(intfieldId) { BrieCallBack callback =new BrieCallBack(this); this.Store.PsDatastore.BrieAccessCheck(callback, 0x17, fieldId); this.FieldData.SetFieldStates(callback.FieldStates); } privateobject CalculateNodeNameField(intfname, int fid, int revision) { objectfieldValue = this.GetFieldValue(fid, revision); if(fieldValue isint) { returnthis.m_store.TreeIdToNodeName((int) fieldValue); } returnfieldValue; } privateobject CalculateTreeLevelField(intflevel, intflevel1, intfid, int revision) { objectfieldValue = this.GetFieldValue(fid, revision); if(fieldValue isint) { returnthis.m_store.TreeIdToNodeLevel((int) fieldValue, (flevel1 - flevel) + 1); } returnfieldValue; } privateobject CalculateTreePathField(intfpath, int fid, int revision) { objectfieldValue = this.GetFieldValue(fid, revision); if(fieldValue isint) { returnthis.m_store.TreeIdToPath((int) fieldValue); } returnfieldValue; } privatevoid CheckType() { WorkItemType type =this.Type; } privatevoid CheckUpdateCachedData() { boolflag = false; if(this.m_store.MetadataVersion !=this.m_metadataVersion) { flag =true; } intmetadataVersion = this.m_store.MetadataVersion; if(this.m_project ==null) { objectfieldValue = this.GetFieldValue(-2, -2); if(fieldValue != null) { this.m_project =this.m_store.TreeIdToProject((int) fieldValue); } } elseif (flag) { this.m_project =this.m_store.Projects.GetById(this.m_project.Id); this.m_type =null; } if((this.m_type ==null) && (this.m_project !=null)) { stringstr = (string)this.GetFieldValue(0x19, -2); if(!string.IsNullOrEmpty(str) &&this.m_project.WorkItemTypes.Contains(str)) { this.m_type =this.m_project.WorkItemTypes[str]; } } this.m_metadataVersion = metadataVersion; } publicvoid Close() { if(!this.IsNew) { this.m_fieldsData =new WorkItemFieldData(this); this.m_linksData =new WorkItemLinkData(this); this.m_revisions =null; this.m_attachments =null; this.m_links =null; this.m_wlinks =null; this.m_wlinksHistory =null; this.m_fields =null; if(this.m_list !=null) { this.m_openState = OpenState.Queried; } else { this.m_openState = OpenState.Undefined; } } } internalvoid ConvertFieldValueToExternal(refobject value, System.Type type) { if((value == null) && (type ==typeof(string))) { value =string.Empty; } elseif (value isDateTime) { value =this.Store.ConvertToLocalTime((DateTime) value); } } internalWorkItemFieldData.FieldFlags ConvertFieldValueToInternal(refobject value, System.Type type) { if(value == null) { return0; } try { objectobj2 = value; if(value.GetType() != type) { if((type == typeof(Guid)) && (valueis string)) { obj2 =new Guid((string) value); }

人气教程排行