共用方式為


AccessControlExtensions.GetAccessAsync 方法

定義

多載

GetAccessAsync(IAssetsAccessContext, String, AssetsLockScope, CancellationToken, Int32)

取得檔案或資料夾的存取權 (資料夾存取權會以遞歸方式套用至該資料夾下的所有專案) 。

注意:如果 CacnelRequest 範圍在取消令牌) 之外變成作用中 (,則會擲回已取消的例外狀況。

GetAccessAsync(IAssetsAccessManager, ContextPriority, IEnumerable<String>, SharingMode, AssetsLockScope, CancellationToken, Int32)

取得檔案或資料夾的存取權 (資料夾存取權會以遞歸方式套用至該資料夾下的所有專案) 。

注意:如果 CacnelRequest 範圍在取消令牌) 之外變成作用中 (,則會擲回已取消的例外狀況。

GetAccessAsync(IAssetsAccessManager, ContextPriority, String, SharingMode, AssetsLockScope, CancellationToken, Int32)

取得檔案或資料夾的存取權 (資料夾存取權會以遞歸方式套用至該資料夾下的所有專案) 。

注意:如果 CacnelRequest 範圍在取消令牌) 之外變成作用中 (,則會擲回已取消的例外狀況。

GetAccessAsync(IAssetsAccessContext, String, AssetsLockScope, CancellationToken, Int32)

取得檔案或資料夾的存取權 (資料夾存取權會以遞歸方式套用至該資料夾下的所有專案) 。

注意:如果 CacnelRequest 範圍在取消令牌) 之外變成作用中 (,則會擲回已取消的例外狀況。

public static System.Threading.Tasks.Task<Microsoft.VisualStudio.Workspace.AssetsControl.IAssetsLock> GetAccessAsync (this Microsoft.VisualStudio.Workspace.AssetsControl.IAssetsAccessContext context, string filePath, Microsoft.VisualStudio.Workspace.AssetsControl.AssetsLockScope lockScope = Microsoft.VisualStudio.Workspace.AssetsControl.AssetsLockScope.Item, System.Threading.CancellationToken cancel = default, int timeout = -1);
static member GetAccessAsync : Microsoft.VisualStudio.Workspace.AssetsControl.IAssetsAccessContext * string * Microsoft.VisualStudio.Workspace.AssetsControl.AssetsLockScope * System.Threading.CancellationToken * int -> System.Threading.Tasks.Task<Microsoft.VisualStudio.Workspace.AssetsControl.IAssetsLock>
<Extension()>
Public Function GetAccessAsync (context As IAssetsAccessContext, filePath As String, Optional lockScope As AssetsLockScope = Microsoft.VisualStudio.Workspace.AssetsControl.AssetsLockScope.Item, Optional cancel As CancellationToken = Nothing, Optional timeout As Integer = -1) As Task(Of IAssetsLock)

參數

context
IAssetsAccessContext

資產存取內容

filePath
String

檔案或資料夾的路徑可以是絕對或 WorkspaceRoot 相對路徑

lockScope
AssetsLockScope

鎖定範圍

cancel
CancellationToken

取消標記

timeout
Int32

等候 (的時間上限,以毫秒為單位) 。

傳回

如果達到逾時,存取鎖定物件會傳回 null,如果取消則會擲回

適用於

GetAccessAsync(IAssetsAccessManager, ContextPriority, IEnumerable<String>, SharingMode, AssetsLockScope, CancellationToken, Int32)

取得檔案或資料夾的存取權 (資料夾存取權會以遞歸方式套用至該資料夾下的所有專案) 。

注意:如果 CacnelRequest 範圍在取消令牌) 之外變成作用中 (,則會擲回已取消的例外狀況。

public static System.Threading.Tasks.Task<Microsoft.VisualStudio.Workspace.AssetsControl.IAssetsLock> GetAccessAsync (this Microsoft.VisualStudio.Workspace.AssetsControl.IAssetsAccessManager accessControl, Microsoft.VisualStudio.Workspace.AssetsControl.ContextPriority priority, System.Collections.Generic.IEnumerable<string> filePaths, Microsoft.VisualStudio.Workspace.AssetsControl.SharingMode sharingMode = Microsoft.VisualStudio.Workspace.AssetsControl.SharingMode.Exclusive, Microsoft.VisualStudio.Workspace.AssetsControl.AssetsLockScope lockScope = Microsoft.VisualStudio.Workspace.AssetsControl.AssetsLockScope.Item, System.Threading.CancellationToken cancel = default, int timeout = -1);
static member GetAccessAsync : Microsoft.VisualStudio.Workspace.AssetsControl.IAssetsAccessManager * Microsoft.VisualStudio.Workspace.AssetsControl.ContextPriority * seq<string> * Microsoft.VisualStudio.Workspace.AssetsControl.SharingMode * Microsoft.VisualStudio.Workspace.AssetsControl.AssetsLockScope * System.Threading.CancellationToken * int -> System.Threading.Tasks.Task<Microsoft.VisualStudio.Workspace.AssetsControl.IAssetsLock>
<Extension()>
Public Function GetAccessAsync (accessControl As IAssetsAccessManager, priority As ContextPriority, filePaths As IEnumerable(Of String), Optional sharingMode As SharingMode = Microsoft.VisualStudio.Workspace.AssetsControl.SharingMode.Exclusive, Optional lockScope As AssetsLockScope = Microsoft.VisualStudio.Workspace.AssetsControl.AssetsLockScope.Item, Optional cancel As CancellationToken = Nothing, Optional timeout As Integer = -1) As Task(Of IAssetsLock)

參數

accessControl
IAssetsAccessManager

訪問控制服務

priority
ContextPriority

工作的優先順序

filePaths
IEnumerable<String>

代表檔案或資料夾路徑的字串集合,可以是絕對或 WorkspaceRoot 相對專案

sharingMode
SharingMode

共用模式

lockScope
AssetsLockScope

子系鎖定範圍

cancel
CancellationToken

取消標記

timeout
Int32

等候 (的時間上限,以毫秒為單位) 。

傳回

存取鎖定物件,如果逾時已過期,則為 null

適用於

GetAccessAsync(IAssetsAccessManager, ContextPriority, String, SharingMode, AssetsLockScope, CancellationToken, Int32)

取得檔案或資料夾的存取權 (資料夾存取權會以遞歸方式套用至該資料夾下的所有專案) 。

注意:如果 CacnelRequest 範圍在取消令牌) 之外變成作用中 (,則會擲回已取消的例外狀況。

public static System.Threading.Tasks.Task<Microsoft.VisualStudio.Workspace.AssetsControl.IAssetsLock> GetAccessAsync (this Microsoft.VisualStudio.Workspace.AssetsControl.IAssetsAccessManager accessControl, Microsoft.VisualStudio.Workspace.AssetsControl.ContextPriority priority, string filePath, Microsoft.VisualStudio.Workspace.AssetsControl.SharingMode sharingMode = Microsoft.VisualStudio.Workspace.AssetsControl.SharingMode.Exclusive, Microsoft.VisualStudio.Workspace.AssetsControl.AssetsLockScope lockScope = Microsoft.VisualStudio.Workspace.AssetsControl.AssetsLockScope.Item, System.Threading.CancellationToken cancel = default, int timeout = -1);
static member GetAccessAsync : Microsoft.VisualStudio.Workspace.AssetsControl.IAssetsAccessManager * Microsoft.VisualStudio.Workspace.AssetsControl.ContextPriority * string * Microsoft.VisualStudio.Workspace.AssetsControl.SharingMode * Microsoft.VisualStudio.Workspace.AssetsControl.AssetsLockScope * System.Threading.CancellationToken * int -> System.Threading.Tasks.Task<Microsoft.VisualStudio.Workspace.AssetsControl.IAssetsLock>
<Extension()>
Public Function GetAccessAsync (accessControl As IAssetsAccessManager, priority As ContextPriority, filePath As String, Optional sharingMode As SharingMode = Microsoft.VisualStudio.Workspace.AssetsControl.SharingMode.Exclusive, Optional lockScope As AssetsLockScope = Microsoft.VisualStudio.Workspace.AssetsControl.AssetsLockScope.Item, Optional cancel As CancellationToken = Nothing, Optional timeout As Integer = -1) As Task(Of IAssetsLock)

參數

accessControl
IAssetsAccessManager

訪問控制服務

priority
ContextPriority

工作的優先順序

filePath
String

檔案或資料夾的路徑可以是絕對或 WorkspaceRoot 相對路徑

sharingMode
SharingMode

共用模式

lockScope
AssetsLockScope

子系鎖定範圍

cancel
CancellationToken

取消標記

timeout
Int32

等候 (的時間上限,以毫秒為單位) 。

傳回

存取鎖定物件

適用於