Skip to content

Commit

Permalink
Updates from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
ajcvickers committed Apr 20, 2021
1 parent 25176d1 commit e3b557d
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ public static void SetIsStored(this IMutableProperty property, bool? value)
/// </summary>
/// <param name="property"> The property. </param>
/// <param name="defaultValue"> The default value, or the CLR default if no explicit default has been set. </param>
/// <returns> The object that is used as the default value for the column this property is mapped to. </returns>
/// <returns> <see langword="true" /> if a default value has been explicitly set; <see langword="false" /> otherwise. </returns>
public static bool TryGetDefaultValue(this IReadOnlyProperty property, out object? defaultValue)
{
var annotation = property.FindAnnotation(RelationalAnnotationNames.DefaultValue);
Expand Down Expand Up @@ -744,7 +744,7 @@ public static bool TryGetDefaultValue(this IReadOnlyProperty property, out objec
/// <param name="property"> The property. </param>
/// <param name="storeObject"> The identifier of the table-like store object containing the column. </param>
/// <param name="defaultValue"> The default value, or the CLR default if no explicit default has been set. </param>
/// <returns> The object that is used as the default value for the column this property is mapped to. </returns>
/// <returns> <see langword="true" /> if a default value has been explicitly set; <see langword="false" /> otherwise. </returns>
public static bool TryGetDefaultValue(
this IReadOnlyProperty property,
in StoreObjectIdentifier storeObject,
Expand Down
4 changes: 2 additions & 2 deletions src/EFCore/Storage/ValueConversion/BytesToStringConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public class BytesToStringConverter : ValueConverter<byte[]?, string?>
public BytesToStringConverter(
ConverterMappingHints? mappingHints = null)
: base(
v => v == null ? null! : Convert.ToBase64String(v),
v => v == null ? null! : Convert.FromBase64String(v),
v => v == null ? null : Convert.ToBase64String(v),
v => v == null ? null : Convert.FromBase64String(v),
convertsNulls: true,
mappingHints)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public class IPAddressToBytesConverter : ValueConverter<IPAddress?, byte[]?>
/// </param>
public IPAddressToBytesConverter(ConverterMappingHints? mappingHints = null)
: base(
v => v == null ? default! : v.GetAddressBytes(),
v => v == null ? default! : new IPAddress(v),
v => v == null ? default : v.GetAddressBytes(),
v => v == null ? default : new IPAddress(v),
convertsNulls: true,
_defaultHints.With(mappingHints))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ public IPAddressToStringConverter(ConverterMappingHints? mappingHints = null)
= new(typeof(IPAddress), typeof(string), i => new IPAddressToStringConverter(i.MappingHints), _defaultHints);

private static new Expression<Func<IPAddress?, string?>> ToString()
=> v => v == null ? default! : v.ToString();
=> v => v == null ? default : v.ToString();

private static Expression<Func<string?, IPAddress?>> ToIPAddress()
=> v => v == null ? default! : IPAddress.Parse(v);
=> v => v == null ? default : IPAddress.Parse(v);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public class PhysicalAddressToBytesConverter : ValueConverter<PhysicalAddress?,
/// </param>
public PhysicalAddressToBytesConverter(ConverterMappingHints? mappingHints = null)
: base(
v => v == null ? default! : v.GetAddressBytes(),
v => v == null ? default! : new PhysicalAddress(v),
v => v == null ? default : v.GetAddressBytes(),
v => v == null ? default : new PhysicalAddress(v),
convertsNulls: true,
_defaultHints.With(mappingHints))
{
Expand Down
4 changes: 2 additions & 2 deletions src/EFCore/Storage/ValueConversion/StringToBytesConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public StringToBytesConverter(
Encoding encoding,
ConverterMappingHints? mappingHints = null)
: base(
v => v == null ? null! : encoding.GetBytes(v),
v => v == null ? null! : encoding.GetString(v),
v => v == null ? null : encoding.GetBytes(v),
v => v == null ? null : encoding.GetString(v),
convertsNulls: true,
mappingHints)
{
Expand Down

0 comments on commit e3b557d

Please sign in to comment.