RelationalTypeMappingSource 类

定义

关系类型映射源的基类。 关系提供程序应派生自此类并重写 Microsoft.EntityFrameworkCore.Storage.RelationalTypeMappingSource.FindMapping(Microsoft.EntityFrameworkCore.Storage.RelationalTypeMappingInfo@)

此类型通常由数据库提供程序 (和其他扩展) 使用。 它通常不用于应用程序代码。

public abstract class RelationalTypeMappingSource : Microsoft.EntityFrameworkCore.Storage.TypeMappingSourceBase, Microsoft.EntityFrameworkCore.Storage.IRelationalTypeMappingSource
type RelationalTypeMappingSource = class
    inherit TypeMappingSourceBase
    interface IRelationalTypeMappingSource
    interface ITypeMappingSource
Public MustInherit Class RelationalTypeMappingSource
Inherits TypeMappingSourceBase
Implements IRelationalTypeMappingSource
继承
RelationalTypeMappingSource
实现

注解

服务生存期为 Singleton。 这意味着单个实例由许多 DbContext 实例使用。 实现必须是线程安全的。 此服务不能依赖于注册为 的服务 Scoped

有关详细信息 和示例,请参阅数据库提供程序和扩展的实现

构造函数

RelationalTypeMappingSource(TypeMappingSourceDependencies, RelationalTypeMappingSourceDependencies)

初始化此类的新实例。

属性

Dependencies

此服务的依赖项。

(继承自 TypeMappingSourceBase)
RelationalDependencies

此服务的关系提供程序特定的依赖项。

方法

FindCollectionMapping(RelationalTypeMappingInfo, Type, Type, CoreTypeMapping)

这是一个支持 Entity Framework Core 基础结构的内部 API,不受与公共 API 相同的兼容性标准的约束。 可能会在任何版本中更改或删除它,而无需通知。 仅应在代码中非常谨慎地直接使用它,并且知道在更新到新的 Entity Framework Core 版本时这样做可能会导致应用程序失败。

FindMapping(IElementType)

查找给定 IElementType的类型映射。

FindMapping(IElementType)

查找给定 IElementType的类型映射。

(继承自 TypeMappingSourceBase)
FindMapping(IProperty)

查找给定 IProperty的类型映射。

FindMapping(MemberInfo)

查找表示 CLR 类型的字段或属性的给定 MemberInfo 的类型映射。

FindMapping(RelationalTypeMappingInfo)

由关系数据库提供程序重写,以查找给定信息的类型映射。

FindMapping(String)

查找给定数据库类型名称的类型映射。

FindMapping(Type)

查找给定 Type的类型映射。

FindMapping(Type, IModel)

查找给定 Type的类型映射,将预约定配置纳入帐户。

FindMapping(Type, IModel)

查找给定 Type的类型映射,将预约定配置纳入帐户。

(继承自 TypeMappingSourceBase)
FindMapping(Type, IModel, CoreTypeMapping)

查找给定 Type的类型映射,将预约定配置纳入帐户。

FindMapping(Type, IModel, CoreTypeMapping)

查找给定 Type的类型映射,将预约定配置纳入帐户。

(继承自 TypeMappingSourceBase)
FindMapping(Type, String, Boolean, Nullable<Boolean>, Nullable<Int32>, Nullable<Boolean>, Nullable<Boolean>, Nullable<Int32>, Nullable<Int32>)

查找给定 Type 和附加方面的类型映射。

FindMapping(TypeMappingInfo)

改为调用Microsoft.EntityFrameworkCore.Storage.RelationalTypeMappingSource.FindMapping(Microsoft.EntityFrameworkCore.Storage.RelationalTypeMappingInfo@)

FindMappingWithConversion(RelationalTypeMappingInfo, IReadOnlyList<IProperty>)

此 API 支持 Entity Framework Core 基础结构,不应直接从代码使用。 将来的版本中可能会更改或删除此 API。

ParseStoreTypeName(String, Nullable<Boolean>, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>)

分析特定于提供程序的存储类型名称,提取 (标准方面,例如大小、精度) ,并返回基本存储类型名称 (,且没有任何分面) 。

TryFindJsonCollectionMapping(TypeMappingInfo, Type, Type, CoreTypeMapping, ValueComparer, JsonValueReaderWriter)

尝试查找基元类型集合的基于 JSON 的类型映射。

(继承自 TypeMappingSourceBase)
ValidateMapping(CoreTypeMapping, IProperty)

在找到映射后调用,以便可以针对给定属性对其进行验证。

(继承自 TypeMappingSourceBase)

显式接口实现

IRelationalTypeMappingSource.FindMapping(IProperty)

查找给定 IProperty的类型映射。

IRelationalTypeMappingSource.FindMapping(MemberInfo)

查找表示 CLR 类型的字段或属性的给定 MemberInfo 的类型映射。

IRelationalTypeMappingSource.FindMapping(Type)

查找给定 Type的类型映射。

IRelationalTypeMappingSource.FindMapping(Type, IModel)

查找给定 Type的类型映射,将预约定配置纳入帐户。

扩展方法

GetMapping(IRelationalTypeMappingSource, IProperty)

获取给定属性的关系数据库类型,如果未找到映射,则引发该类型。

GetMapping(IRelationalTypeMappingSource, String)

获取表示给定数据库类型的映射,如果未找到映射,则引发该映射。

GetMapping(IRelationalTypeMappingSource, Type)

获取给定 .NET 类型的关系数据库类型,如果未找到映射,则引发。

GetMapping(IRelationalTypeMappingSource, Type, IModel)

获取给定 .NET 类型的关系数据库类型,如果未找到映射,则引发。

GetMappingForValue(IRelationalTypeMappingSource, Object)

获取给定对象的关系数据库类型,如果未找到映射,则引发该类型。

GetMappingForValue(IRelationalTypeMappingSource, Object, IModel)

获取给定对象的关系数据库类型,如果未找到映射,则引发该类型。

适用于