Remove sbyte from clr mappings. Not needed as EF Core will use automatic conversions for those types. EF Core SQL Server behaves the same

pull/137/head
Christopher Jolly 3 years ago
parent 9489bc4564
commit 6cb1748237

@ -24,7 +24,7 @@ namespace EntityFrameworkCore.Jet.Storage.Internal
DbType? dbType = null,
int? precision = null,
int? scale = null,
StoreTypePostfix storeTypePostfix = StoreTypePostfix.None)
StoreTypePostfix storeTypePostfix = StoreTypePostfix.PrecisionAndScale)
: base(
new RelationalTypeMappingParameters(
new CoreTypeMappingParameters(typeof(decimal)),
@ -70,6 +70,16 @@ namespace EntityFrameworkCore.Jet.Storage.Internal
{
parameter.Size = Size.Value;
}
if (Precision.HasValue)
{
parameter.Precision = unchecked((byte)Precision.Value);
}
if (Scale.HasValue)
{
parameter.Scale = unchecked((byte)Scale.Value);
}
}
}
}

@ -40,7 +40,7 @@ namespace EntityFrameworkCore.Jet.Storage.Internal
private readonly JetFloatTypeMapping _single = new JetFloatTypeMapping("single");
private readonly JetDoubleTypeMapping _double = new JetDoubleTypeMapping("double");
private readonly JetDecimalTypeMapping _decimal = new JetDecimalTypeMapping("decimal", DbType.Decimal, precision: 18, scale: 10, StoreTypePostfix.PrecisionAndScale);
private readonly JetDecimalTypeMapping _decimal = new JetDecimalTypeMapping("decimal", DbType.Decimal, precision: 18, scale: 2, StoreTypePostfix.PrecisionAndScale);
private readonly JetCurrencyTypeMapping _currency = new JetCurrencyTypeMapping("currency");
private readonly JetDateTimeTypeMapping _datetime;
@ -181,14 +181,11 @@ namespace EntityFrameworkCore.Jet.Storage.Internal
{"timestamp", _rowversion},
};
// Note: sbyte, ushort, uint, char, long and ulong type mappings are not supported by Jet.
// We would need the type conversions feature to allow this to work - see https://github.com/aspnet/EntityFramework/issues/242.
_clrTypeMappings
= new Dictionary<Type, RelationalTypeMapping>
{
{typeof(bool), _bool},
{typeof(byte), _byte},
{typeof(sbyte), _smallint},
{typeof(short), _smallint},
{typeof(int), _integer},
{typeof(long), _bigint},

Loading…
Cancel
Save