RequestContextExtensions.CreateComponent<TInterface, TComponent> 方法 (TeamFoundationRequestContext, String)

建立可用於通訊至資料庫版本的元件。 建構透過介面,讓它使用 Fakes 更加一般來說是模擬/stubbable。

命名空間:  Microsoft.TeamFoundation.Framework.Server
組件:  Microsoft.TeamFoundation.Framework.Server (在 Microsoft.TeamFoundation.Framework.Server.dll 中)

語法

'宣告
<ExtensionAttribute> _
Public Shared Function CreateComponent(Of TInterface, TComponent As {Class, New, ISqlResourceComponent, TInterface}) ( _
    context As TeamFoundationRequestContext, _
    databaseCategory As String _
) As TInterface
public static TInterface CreateComponent<TInterface, TComponent>(
    this TeamFoundationRequestContext context,
    string databaseCategory
)
where TComponent : class, new(), ISqlResourceComponent, TInterface

類型參數

  • TInterface
    元件實作的介面 mockable
  • TComponent
    要建立的元件型別。

參數

傳回值

類型:TInterface

使用注意事項

在 Visual Basic 和 C# 中,您可以在任何 TeamFoundationRequestContext 類型物件中呼叫這個方法以做為執行個體。使用執行個體方法語法呼叫這個方法時,請省略第一個參數。如需詳細資訊,請參閱 擴充方法 (Visual Basic)擴充方法 (C# 程式設計手冊)

.NET Framework 安全性

請參閱

參考

RequestContextExtensions 類別

CreateComponent 多載

Microsoft.TeamFoundation.Framework.Server 命名空間