PropertyBuilder.HasConversion 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
HasConversion(Type, Type, Type)
配置 属性,以便在写入数据库之前转换属性值,并在从数据库读取数据时转换回来。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasConversion (Type conversionType, Type? comparerType, Type? providerComparerType);
abstract member HasConversion : Type * Type * Type -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
override this.HasConversion : Type * Type * Type -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
Public Overridable Function HasConversion (conversionType As Type, comparerType As Type, providerComparerType As Type) As PropertyBuilder
参数
- conversionType
- Type
要转换到和转换自 的类型,或继承自 ValueConverter的类型。
- comparerType
- Type
继承自 ValueComparer的类型。
- providerComparerType
- Type
继承自 ValueComparer 的类型,用于提供程序值。
返回
同一生成器实例,以便可以链接多个配置调用。
适用于
HasConversion(Type, ValueComparer)
配置 属性,以便在写入数据库之前转换属性值,并在从数据库读取数据时转换回来。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasConversion (Type providerClrType, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer valueComparer);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasConversion (Type conversionType, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? valueComparer);
abstract member HasConversion : Type * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
override this.HasConversion : Type * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
abstract member HasConversion : Type * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
override this.HasConversion : Type * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
Public Overridable Function HasConversion (providerClrType As Type, valueComparer As ValueComparer) As PropertyBuilder
Public Overridable Function HasConversion (conversionType As Type, valueComparer As ValueComparer) As PropertyBuilder
参数
- providerClrTypeconversionType
- Type
要转换为和转换自的类型。
- valueComparer
- ValueComparer
转换前要用于值的比较器。
返回
同一生成器实例,以便可以链接多个配置调用。
适用于
HasConversion(ValueConverter, ValueComparer, ValueComparer)
配置 属性,以便使用给定 ValueConverter的 将属性值与数据库进行转换和转换。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasConversion (Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter? converter, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? valueComparer, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? providerComparer);
abstract member HasConversion : Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
override this.HasConversion : Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
Public Overridable Function HasConversion (converter As ValueConverter, valueComparer As ValueComparer, providerComparer As ValueComparer) As PropertyBuilder
参数
- converter
- ValueConverter
要使用的转换器。
- valueComparer
- ValueComparer
转换前要用于值的比较器。
- providerComparer
- ValueComparer
要用于提供程序值的比较器。
返回
同一生成器实例,以便可以链接多个配置调用。
适用于
HasConversion(Type, ValueComparer, ValueComparer)
配置 属性,以便在写入数据库之前转换属性值,并在从数据库读取数据时转换回来。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasConversion (Type conversionType, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? valueComparer, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? providerComparer);
abstract member HasConversion : Type * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
override this.HasConversion : Type * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
Public Overridable Function HasConversion (conversionType As Type, valueComparer As ValueComparer, providerComparer As ValueComparer) As PropertyBuilder
参数
- conversionType
- Type
要转换到和转换自 的类型,或继承自 ValueConverter的类型。
- valueComparer
- ValueComparer
转换前要用于值的比较器。
- providerComparer
- ValueComparer
要用于提供程序值的比较器。
返回
同一生成器实例,以便可以链接多个配置调用。
适用于
HasConversion(Type)
配置 属性,以便在写入数据库之前转换属性值,并在从数据库读取数据时转换回来。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasConversion (Type providerClrType);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasConversion (Type? conversionType);
abstract member HasConversion : Type -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
override this.HasConversion : Type -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
abstract member HasConversion : Type -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
override this.HasConversion : Type -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
Public Overridable Function HasConversion (providerClrType As Type) As PropertyBuilder
Public Overridable Function HasConversion (conversionType As Type) As PropertyBuilder
参数
- providerClrTypeconversionType
- Type
要转换为和转换自的类型。
返回
同一生成器实例,以便可以链接多个配置调用。
适用于
HasConversion(ValueConverter, ValueComparer)
配置 属性,以便使用给定 ValueConverter的 将属性值与数据库进行转换和转换。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasConversion (Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter converter, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer valueComparer);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasConversion (Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter? converter, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? valueComparer);
abstract member HasConversion : Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
override this.HasConversion : Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
Public Overridable Function HasConversion (converter As ValueConverter, valueComparer As ValueComparer) As PropertyBuilder
参数
- converter
- ValueConverter
要使用的转换器。
- valueComparer
- ValueComparer
转换前要用于值的比较器。
返回
同一生成器实例,以便可以链接多个配置调用。
适用于
HasConversion(ValueConverter)
配置 属性,以便使用给定 ValueConverter的 将属性值与数据库进行转换和转换。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasConversion (Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter converter);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasConversion (Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter? converter);
abstract member HasConversion : Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
override this.HasConversion : Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverter -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
Public Overridable Function HasConversion (converter As ValueConverter) As PropertyBuilder
参数
- converter
- ValueConverter
要使用的转换器。
返回
同一生成器实例,以便可以链接多个配置调用。
适用于
HasConversion(Type, Type)
配置 属性,以便在写入数据库之前转换属性值,并在从数据库读取数据时转换回来。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasConversion (Type conversionType, Type? comparerType);
abstract member HasConversion : Type * Type -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
override this.HasConversion : Type * Type -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
Public Overridable Function HasConversion (conversionType As Type, comparerType As Type) As PropertyBuilder
参数
- conversionType
- Type
要转换到和转换自 的类型,或继承自 ValueConverter的类型。
- comparerType
- Type
继承自 ValueComparer的类型。
返回
同一生成器实例,以便可以链接多个配置调用。
适用于
HasConversion<TConversion,TComparer,TProviderComparer>()
配置 属性,以便在写入数据库之前转换属性值,并在从数据库读取数据时转换回来。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasConversion<TConversion,TComparer,TProviderComparer> () where TComparer : Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer where TProviderComparer : Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer;
abstract member HasConversion : unit -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder (requires 'Comparer :> Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer and 'ProviderComparer :> Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer)
override this.HasConversion : unit -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder (requires 'Comparer :> Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer and 'ProviderComparer :> Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer)
Public Overridable Function HasConversion(Of TConversion, TComparer, TProviderComparer) () As PropertyBuilder
类型参数
- TConversion
要转换到和转换自 的类型,或继承自 ValueConverter的类型。
- TComparer
继承自 ValueComparer的类型。
- TProviderComparer
继承自 ValueComparer 的类型,用于提供程序值。
返回
同一生成器实例,以便可以链接多个配置调用。
适用于
HasConversion<TConversion,TComparer>()
配置 属性,以便在写入数据库之前转换属性值,并在从数据库读取数据时转换回来。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasConversion<TConversion,TComparer> () where TComparer : Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer;
abstract member HasConversion : unit -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder (requires 'Comparer :> Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer)
override this.HasConversion : unit -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder (requires 'Comparer :> Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer)
Public Overridable Function HasConversion(Of TConversion, TComparer) () As PropertyBuilder
类型参数
- TConversion
要转换到和转换自 的类型,或继承自 ValueConverter的类型。
- TComparer
继承自 ValueComparer的类型。
返回
同一生成器实例,以便可以链接多个配置调用。
适用于
HasConversion<TConversion>(ValueComparer, ValueComparer)
配置 属性,以便在写入数据库之前转换属性值,并在从数据库读取数据时转换回来。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasConversion<TConversion> (Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? valueComparer, Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? providerComparer);
abstract member HasConversion : Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
override this.HasConversion : Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer * Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
Public Overridable Function HasConversion(Of TConversion) (valueComparer As ValueComparer, providerComparer As ValueComparer) As PropertyBuilder
类型参数
- TConversion
要转换到和转换自 的类型,或继承自 ValueConverter的类型。
参数
- valueComparer
- ValueComparer
转换前要用于值的比较器。
- providerComparer
- ValueComparer
要用于提供程序值的比较器。
返回
同一生成器实例,以便可以链接多个配置调用。
适用于
HasConversion<TConversion>()
配置 属性,以便在写入数据库之前转换属性值,并在从数据库读取数据时转换回来。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasConversion<TProvider> ();
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasConversion<TConversion> ();
abstract member HasConversion : unit -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
override this.HasConversion : unit -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
Public Overridable Function HasConversion(Of TProvider) () As PropertyBuilder
Public Overridable Function HasConversion(Of TConversion) () As PropertyBuilder
类型参数
- TProvider TConversion
要转换到和转换自 的类型,或继承自 ValueConverter的类型。
返回
同一生成器实例,以便可以链接多个配置调用。
适用于
HasConversion<TConversion>(ValueComparer)
配置 属性,以便在写入数据库之前转换属性值,并在从数据库读取数据时转换回来。
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasConversion<TProvider> (Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer valueComparer);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder HasConversion<TConversion> (Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer? valueComparer);
abstract member HasConversion : Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
override this.HasConversion : Microsoft.EntityFrameworkCore.ChangeTracking.ValueComparer -> Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder
Public Overridable Function HasConversion(Of TProvider) (valueComparer As ValueComparer) As PropertyBuilder
Public Overridable Function HasConversion(Of TConversion) (valueComparer As ValueComparer) As PropertyBuilder
类型参数
- TProvider TConversion
要转换到和转换自 的类型,或继承自 ValueConverter的类型。
参数
- valueComparer
- ValueComparer
转换前要用于值的比较器。
返回
同一生成器实例,以便可以链接多个配置调用。