IDbDependencyResolver.GetServices 方法
[本页针对的是实体框架版本 6。最新版本以“实体框架”NuGet 包的形式提供。有关实体框架的更多信息,请参见 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>
解析依赖项的所有服务,它们必须是给定协定类型的实例,如果无法解析依赖项,则为空枚举。