IDbDependencyResolver 接口

[本页针对的是实体框架版本 6。最新版本以“实体框架”NuGet 包的形式提供。有关实体框架的更多信息,请参见 msdn.com/data/ef。]

此接口由可以解析依赖项(直接解析或通过使用外部容器进行解析)的任何对象实现。

命名空间:  System.Data.Entity.Infrastructure.DependencyResolution
程序集:  EntityFramework(在 EntityFramework.dll 中)

语法

声明
Public Interface IDbDependencyResolver
用法
Dim instance As IDbDependencyResolver
public interface IDbDependencyResolver
public interface class IDbDependencyResolver
type IDbDependencyResolver =  interface end
public interface IDbDependencyResolver

IDbDependencyResolver 类型公开以下成员。

方法

  名称 描述
公共方法 GetService 尝试为给定的协定类型和可选的给定键解析依赖项。如果解析程序无法解析依赖项,则它必须返回 null 并且不引发。这允许解析程序用于责任链模式中,以便可以请求多个解析程序解析某一依赖项,直到其中一个解析程序最终解析了该依赖项。
公共方法 GetServices 尝试为给定协定类型和可选的给定键解析依赖项。如果解析程序无法解析依赖项,则它必须返回空枚举并且不引发。此方法与 GetService(Type, Object) 不同,因为它返回给定类型和键组合的所有注册服务。

顶部

扩展方法 

  名称 描述
公共扩展方法 GetService(Type) 已重载。 调用 GetService(Type, Object),以传递给定类型参数并对名称参数使用 null。 (由 DbDependencyResolverExtensions 定义。)
公共扩展方法 GetService<T>() 已重载。 调用 GetService(Type, Object),将该方法的泛型类型作为类型参数传递并为名称参数传递 null。 (由 DbDependencyResolverExtensions 定义。)
公共扩展方法 GetService<T>(Object) 已重载。 调用 GetService(Type, Object),将该方法的泛型类型和给定名称作为参数传递。 (由 DbDependencyResolverExtensions 定义。)
公共扩展方法 GetServices(Type) 已重载。 调用 GetServices(Type, Object),以传递给定类型参数并对名称参数使用 null。 (由 DbDependencyResolverExtensions 定义。)
公共扩展方法 GetServices<T>() 已重载。 调用 GetServices(Type, Object),将该方法的泛型类型作为类型参数传递并为名称参数传递 null。 (由 DbDependencyResolverExtensions 定义。)
公共扩展方法 GetServices<T>(Object) 已重载。 调用 GetServices(Type, Object),将该方法的泛型类型和给定名称作为参数传递。 (由 DbDependencyResolverExtensions 定义。)

顶部

备注

当前使用 IDbDependencyResolver 解析的公共服务记录如下:https://msdn.microsoft.com/en-us/data/jj680697

请参阅

参考

System.Data.Entity.Infrastructure.DependencyResolution 命名空间