攻击TFS Checkin事件

Jal*_*eel 1 tfs-sdk tfs2010

我正在研究在服务器端的TFS中实现一些签入策略的项目.作为其中的一部分,我正在尝试获取变更集的历史记录.但是当签入时,我将变更集编号设置为-1.我不知道为什么会这样.我怀疑是否仅在执行ProcessEvent方法后分配变更集编号.感谢您的帮助.

public EventNotificationStatus ProcessEvent(TeamFoundationRequestContext requestContext, NotificationType notificationType,
              object notificationEventArgs, out int statusCode, out string statusMessage, out ExceptionPropertyCollection properties)
           {
               statusCode = 0;
               properties = null;
               statusMessage = string.Empty;


               if (notificationType == NotificationType.DecisionPoint)
               {
                   try
                   {
                       if (notificationEventArgs is CheckinNotification)
                       {
                           CheckinNotification notification = notificationEventArgs as CheckinNotification;


                              int changeId = notification.Changeset;; // here I get the Changeset as -1
                       }
                   }
               }
           }
Run Code Online (Sandbox Code Playgroud)

Rob*_*cus 5

您无法获得当前的变更集编号,因为策略是在变更集提交之前执行的.

它必须以这种方式执行,以便在违反策略时拒绝签入.如果签入被拒绝,则不应增加变更集编号.