public GuidToBytesConverter([CanBeNull] ConverterMappingHints?mappingHints = null)
     : base(
         v => v.ToByteArray(),
         v => v == null ? Guid.Empty : new Guid(v),
         _defaultHints.With(mappingHints))
 {
 }
Exemplo n.º 2
0
 /// <summary>
 ///     Creates a new instance of this converter.
 /// </summary>
 /// <param name="mappingHints">
 ///     Hints that can be used by the <see cref="ITypeMappingSource" /> to create data types with appropriate
 ///     facets for the converted data.
 /// </param>
 public StringToBoolConverter(ConverterMappingHints?mappingHints)
     : base(
         v => Convert.ToBoolean(v),
         v => Convert.ToString(v),
         mappingHints)
 {
 }
Exemplo n.º 3
0
 /// <summary>
 ///     Creates a new instance of this converter.
 /// </summary>
 /// <remarks>
 ///     See <see href="https://aka.ms/efcore-docs-value-converters">EF Core value converters</see> for more information and examples.
 /// </remarks>
 /// <param name="mappingHints">
 ///     Hints that can be used by the <see cref="ITypeMappingSource" /> to create data types with appropriate
 ///     facets for the converted data.
 /// </param>
 public GuidToStringConverter(ConverterMappingHints?mappingHints)
     : base(
         ToString(),
         ToGuid(),
         _defaultHints.With(mappingHints))
 {
 }
Exemplo n.º 4
0
 /// <summary>
 ///     Creates a new instance of this converter.
 /// </summary>
 /// <remarks>
 ///     See <see href="https://aka.ms/efcore-docs-value-converters">EF Core value converters</see> for more information.
 /// </remarks>
 /// <param name="mappingHints">
 ///     Hints that can be used by the <see cref="ITypeMappingSource" /> to create data types with appropriate
 ///     facets for the converted data.
 /// </param>
 public NumberToStringConverter(ConverterMappingHints?mappingHints)
     : base(
         ToString(),
         ToNumber(),
         _defaultHints.With(mappingHints))
 {
 }
Exemplo n.º 5
0
 /// <summary>
 ///     Creates a new instance of this converter. This converter does not preserve order.
 /// </summary>
 /// <param name="mappingHints">
 ///     Hints that can be used by the <see cref="ITypeMappingSource" /> to create data types with appropriate
 ///     facets for the converted data.
 /// </param>
 public StringToEnumConverter(ConverterMappingHints?mappingHints = null)
     : base(
         ToEnum(),
         ToString(),
         mappingHints)
 {
 }
Exemplo n.º 6
0
 /// <summary>
 ///     Creates a new instance of this converter.
 /// </summary>
 /// <remarks>
 ///     See <see href="https://aka.ms/efcore-docs-value-converters">EF Core value converters</see> for more information and examples.
 /// </remarks>
 /// <param name="mappingHints">
 ///     Hints that can be used by the <see cref="ITypeMappingSource" /> to create data types with appropriate
 ///     facets for the converted data.
 /// </param>
 public StringToDateTimeConverter(ConverterMappingHints?mappingHints)
     : base(
         ToDateTime(),
         ToString(),
         DefaultHints.With(mappingHints))
 {
 }
 public StringNumberConverter(
     [NotNull] Expression <Func <TModel, TProvider> > convertToProviderExpression,
     [NotNull] Expression <Func <TProvider, TModel> > convertFromProviderExpression,
     [CanBeNull] ConverterMappingHints?mappingHints = null)
     : base(convertToProviderExpression, convertFromProviderExpression, mappingHints)
 {
 }
 public CharToStringConverter([CanBeNull] ConverterMappingHints?mappingHints = null)
     : base(
         ToString(),
         ToChar(),
         _defaultHints.With(mappingHints))
 {
 }
Exemplo n.º 9
0
 public MomentToDateTimeValueConverter(ConverterMappingHints?mappingHints = null)
     : base(
         v => v.ToDateTime(),
         v => v.DefaultKind(DateTimeKind.Utc).ToMoment(),
         mappingHints)
 {
 }
Exemplo n.º 10
0
 public EnumToStringConverter([CanBeNull] ConverterMappingHints?mappingHints = null)
     : base(
         ToString(),
         ToEnum(),
         mappingHints)
 {
 }
Exemplo n.º 11
0
 /// <summary>
 ///     Creates a new instance of this converter.
 /// </summary>
 /// <remarks>
 ///     See <see href="https://aka.ms/efcore-docs-value-converters">EF Core value converters</see> for more information and examples.
 /// </remarks>
 /// <param name="mappingHints">
 ///     Hints that can be used by the <see cref="ITypeMappingSource" /> to create data types with appropriate
 ///     facets for the converted data.
 /// </param>
 public StringToNumberConverter(ConverterMappingHints?mappingHints)
     : base(
         ToNumber(),
         ToString(),
         DefaultHints.With(mappingHints))
 {
 }
Exemplo n.º 12
0
 public DateTimeToBinaryConverter([CanBeNull] ConverterMappingHints?mappingHints = null)
     : base(
         v => v.ToBinary(),
         v => DateTime.FromBinary(v),
         mappingHints)
 {
 }
Exemplo n.º 13
0
 /// <summary>
 ///     Creates a new instance of this converter.
 /// </summary>
 /// <remarks>
 ///     See <see href="https://aka.ms/efcore-docs-value-converters">EF Core value converters</see> for more information.
 /// </remarks>
 /// <param name="mappingHints">
 ///     Hints that can be used by the <see cref="ITypeMappingSource" /> to create data types with appropriate
 ///     facets for the converted data.
 /// </param>
 public StringToTimeSpanConverter(ConverterMappingHints?mappingHints)
     : base(
         ToTimeSpan(),
         ToString(),
         _defaultHints.With(mappingHints))
 {
 }
Exemplo n.º 14
0
 public StringToUriConverter([CanBeNull] ConverterMappingHints?mappingHints = null)
     : base(
         ToUri(),
         ToString(),
         mappingHints)
 {
 }
Exemplo n.º 15
0
 public DateTimeToStringConverter([CanBeNull] ConverterMappingHints?mappingHints = null)
     : base(
         ToString(),
         ToDateTime(),
         _defaultHints.With(mappingHints))
 {
 }
Exemplo n.º 16
0
 /// <summary>
 ///     Creates a new instance of this converter. This converter does not preserve order.
 /// </summary>
 /// <remarks>
 ///     See <see href="https://aka.ms/efcore-docs-value-converters">EF Core value converters</see> for more information and examples.
 /// </remarks>
 /// <param name="mappingHints">
 ///     Hints that can be used by the <see cref="ITypeMappingSource" /> to create data types with appropriate
 ///     facets for the converted data.
 /// </param>
 public EnumToStringConverter(ConverterMappingHints?mappingHints)
     : base(
         ToString(),
         ToEnum(),
         mappingHints)
 {
 }
Exemplo n.º 17
0
 public DateTimeToTicksConverter([CanBeNull] ConverterMappingHints?mappingHints = null)
     : base(
         v => v.Ticks,
         v => new DateTime(v),
         mappingHints)
 {
 }
Exemplo n.º 18
0
 public NewtonsoftJsonSerializedToStringValueConverter(ConverterMappingHints?mappingHints = null)
     : base(
         v => v.Data,
         v => NewtonsoftJsonSerialized.New <T>(v),
         mappingHints)
 {
 }
 /// <summary>
 ///     Creates a new instance of this converter.
 /// </summary>
 /// <param name="mappingHints">
 ///     Hints that can be used by the <see cref="ITypeMappingSource" /> to create data types with appropriate
 ///     facets for the converted data.
 /// </param>
 public DateTimeOffsetToStringConverter(ConverterMappingHints?mappingHints = null)
     : base(
         ToString(),
         ToDateTimeOffset(),
         _defaultHints.With(mappingHints))
 {
 }
Exemplo n.º 20
0
 public SymbolToStringValueConverter(ConverterMappingHints?mappingHints = null)
     : base(
         v => v.Value,
         v => new Symbol(v),
         mappingHints)
 {
 }
Exemplo n.º 21
0
 /// <summary>
 ///     Creates a new instance of this converter. This converter preserves order.
 /// </summary>
 /// <param name="mappingHints">
 ///     Hints that can be used by the <see cref="ITypeMappingSource" /> to create data types with appropriate
 ///     facets for the converted data.
 /// </param>
 public StringToUriConverter(ConverterMappingHints?mappingHints)
     : base(
         ToUri(),
         ToString(),
         mappingHints)
 {
 }
 public StringToTimeSpanConverter([CanBeNull] ConverterMappingHints?mappingHints = null)
     : base(
         ToTimeSpan(),
         ToString(),
         _defaultHints.With(mappingHints))
 {
 }
Exemplo n.º 23
0
 /// <summary>
 ///     Creates a new instance of this converter.
 /// </summary>
 /// <remarks>
 ///     See <see href="https://aka.ms/efcore-docs-value-converters">EF Core value converters</see> for more information and examples.
 /// </remarks>
 /// <param name="mappingHints">
 ///     Hints that can be used by the <see cref="ITypeMappingSource" /> to create data types with appropriate
 ///     facets for the converted data.
 /// </param>
 public DateTimeToTicksConverter(ConverterMappingHints?mappingHints)
     : base(
         v => v.Ticks,
         v => new DateTime(v),
         mappingHints)
 {
 }
Exemplo n.º 24
0
 /// <summary>
 ///     Creates a new instance of this converter. This converter preserves order.
 /// </summary>
 /// <param name="mappingHints">
 ///     Hints that can be used by the <see cref="ITypeMappingSource" /> to create data types with appropriate
 ///     facets for the converted data.
 /// </param>
 public UriToStringConverter(ConverterMappingHints?mappingHints = null)
     : base(
         ToString(),
         ToUri(),
         mappingHints)
 {
 }
Exemplo n.º 25
0
 /// <summary>
 ///     Creates a new instance of this converter.
 /// </summary>
 /// <param name="mappingHints">
 ///     Hints that can be used by the <see cref="ITypeMappingSource" /> to create data types with appropriate
 ///     facets for the converted data.
 /// </param>
 public TimeSpanToStringConverter(ConverterMappingHints?mappingHints = null)
     : base(
         ToString(),
         ToTimeSpan(),
         _defaultHints.With(mappingHints))
 {
 }
Exemplo n.º 26
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="ValueConverter" /> class.
 /// </summary>
 /// <remarks>
 ///     See <see href="https://aka.ms/efcore-docs-value-converters">EF Core value converters</see> for more information.
 /// </remarks>
 /// <param name="convertToProviderExpression">
 ///     The expression to convert objects when writing data to the store,
 ///     exactly as supplied and may not handle
 ///     nulls, boxing, and non-exact matches of simple types.
 /// </param>
 /// <param name="convertFromProviderExpression">
 ///     The expression to convert objects when reading data from the store,
 ///     exactly as supplied and may not handle
 ///     nulls, boxing, and non-exact matches of simple types.
 /// </param>
 /// <param name="mappingHints">
 ///     Hints that can be used by the <see cref="ITypeMappingSource" /> to create data types with appropriate
 ///     facets for the converted data.
 /// </param>
 protected ValueConverter(
     LambdaExpression convertToProviderExpression,
     LambdaExpression convertFromProviderExpression,
     ConverterMappingHints?mappingHints = null)
     : this(convertToProviderExpression, convertFromProviderExpression, false, mappingHints)
 {
 }
Exemplo n.º 27
0
 /// <summary>
 ///     Creates a new instance of this converter.
 /// </summary>
 /// <param name="mappingHints">
 ///     Hints that can be used by the <see cref="ITypeMappingSource" /> to create data types with appropriate
 ///     facets for the converted data.
 /// </param>
 public StringToGuidConverter(ConverterMappingHints?mappingHints = null)
     : base(
         ToGuid(),
         ToString(),
         _defaultHints.With(mappingHints))
 {
 }
Exemplo n.º 28
0
 /// <summary>
 ///     Creates a new instance of this converter.
 /// </summary>
 /// <remarks>
 ///     See <see href="https://aka.ms/efcore-docs-value-converters">EF Core value converters</see> for more information and examples.
 /// </remarks>
 /// <param name="mappingHints">
 ///     Hints that can be used by the <see cref="ITypeMappingSource" /> to create data types with appropriate
 ///     facets for the converted data.
 /// </param>
 public DateTimeToBinaryConverter(ConverterMappingHints?mappingHints)
     : base(
         v => v.ToBinary(),
         v => DateTime.FromBinary(v),
         mappingHints)
 {
 }
Exemplo n.º 29
0
 /// <summary>
 ///     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.
 /// </summary>
 public StringCharConverter(
     Expression <Func <TModel, TProvider> > convertToProviderExpression,
     Expression <Func <TProvider, TModel> > convertFromProviderExpression,
     ConverterMappingHints?mappingHints = null)
     : base(convertToProviderExpression, convertFromProviderExpression, mappingHints)
 {
 }
 public DateTimeOffsetToBytesConverter([CanBeNull] ConverterMappingHints?mappingHints = null)
     : base(
         v => ToBytes(v),
         v => v == null ? default : FromBytes(v),
         _defaultHints.With(mappingHints))
 {
 }