IDbDependencyResolver.GetServices 方法
[此頁面專屬於 Entity Framework 第 6 版。最新版本可從 'Entity Framework' NuGet 套件取得。如需 Entity Framework 的詳細資訊,請參閱 msdn.com/data/ef。]
嘗試依據給定的合約類型和選擇性指定的索引鍵來解析相依性。 如果解析程式無法解析相依性,則必須傳回空白列舉而非擲回。 此方法與 GetService(Type, Object) 不同之處在於,前者會針對指定的類型和索引鍵組合傳回已註冊的所有服務。
命名空間: System.Data.Entity.Infrastructure.DependencyResolution
組件: EntityFramework (在 EntityFramework.dll 中)
語法
'宣告
Function GetServices ( _
type As Type, _
key As Object _
) As IEnumerable(Of Object)
'用途
Dim instance As IDbDependencyResolver
Dim type As Type
Dim key As Object
Dim returnValue As IEnumerable(Of Object)
returnValue = instance.GetServices(type, _
key)
IEnumerable<Object> GetServices(
Type type,
Object key
)
IEnumerable<Object^>^ GetServices(
Type^ type,
Object^ key
)
abstract GetServices :
type:Type *
key:Object -> IEnumerable<Object>
function GetServices(
type : Type,
key : Object
) : IEnumerable<Object>
參數
- type
類型:System.Type
定義所要解析之相依性的介面或抽象基底類別。 每個傳回的物件預期應為此類型的執行個體。
- key
類型:System.Object
所要解析之相依性的索引鍵 (選擇性)。 若相依性不是由索引鍵區別,則其值可能是 null。
傳回值
類型:System.Collections.Generic.IEnumerable<Object>
所有可解析相依性的服務 (必須是指定之合約類型的執行個體),如果無法解析相依性則為空白列舉。