Table of Contents

Class NumberToBytesConverter<TNumber>

Namespace
Microsoft.EntityFrameworkCore.Storage.ValueConversion
Assembly
Microsoft.EntityFrameworkCore.dll

Converts numeric values to and from arrays of bytes.

public class NumberToBytesConverter<TNumber> : ValueConverter<TNumber, byte[]>

Type Parameters

TNumber
Inheritance
ValueConverter<TNumber, byte[]>
NumberToBytesConverter<TNumber>
Inherited Members

Remarks

See EF Core value converters for more information and examples.

Constructors

NumberToBytesConverter()

Creates a new instance of this converter.

public NumberToBytesConverter()

Remarks

This converter supports double, float, decimal, int, long, short, byte, uint, ulong, ushort, sbyte, and char.

See EF Core value converters for more information and examples.

NumberToBytesConverter(ConverterMappingHints?)

Creates a new instance of this converter.

public NumberToBytesConverter(ConverterMappingHints? mappingHints)

Parameters

mappingHints ConverterMappingHints

Hints that can be used by the ITypeMappingSource to create data types with appropriate facets for the converted data.

Remarks

This converter supports double, float, decimal, int, long, short, byte, uint, ulong, ushort, sbyte, and char.

See EF Core value converters for more information and examples.

Properties

DefaultInfo

A ValueConverterInfo for the default use of this converter.

public static ValueConverterInfo DefaultInfo { get; }

Property Value

ValueConverterInfo

Methods

BytesToDecimal(byte[])

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

[EntityFrameworkInternal]
public static decimal BytesToDecimal(byte[] bytes)

Parameters

bytes byte[]

Returns

decimal

DecimalToBytes(decimal)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

[EntityFrameworkInternal]
public static byte[] DecimalToBytes(decimal value)

Parameters

value decimal

Returns

byte[]

ReverseInt(byte[])

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

[EntityFrameworkInternal]
public static byte[] ReverseInt(byte[] bytes)

Parameters

bytes byte[]

Returns

byte[]

ReverseLong(byte[])

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

[EntityFrameworkInternal]
public static byte[] ReverseLong(byte[] bytes)

Parameters

bytes byte[]

Returns

byte[]

ReverseShort(byte[])

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

[EntityFrameworkInternal]
public static byte[] ReverseShort(byte[] bytes)

Parameters

bytes byte[]

Returns

byte[]

ToBytes()

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

[EntityFrameworkInternal]
public static Expression<Func<TNumber, byte[]>> ToBytes()

Returns

Expression<Func<TNumber, byte[]>>

ToNumber()

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

[EntityFrameworkInternal]
public static Expression<Func<byte[], TNumber>> ToNumber()

Returns

Expression<Func<byte[], TNumber>>