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, DbType? dbType = null,
int? precision = null, int? precision = null,
int? scale = null, int? scale = null,
StoreTypePostfix storeTypePostfix = StoreTypePostfix.None) StoreTypePostfix storeTypePostfix = StoreTypePostfix.PrecisionAndScale)
: base( : base(
new RelationalTypeMappingParameters( new RelationalTypeMappingParameters(
new CoreTypeMappingParameters(typeof(decimal)), new CoreTypeMappingParameters(typeof(decimal)),
@ -70,6 +70,16 @@ namespace EntityFrameworkCore.Jet.Storage.Internal
{ {
parameter.Size = Size.Value; 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 JetFloatTypeMapping _single = new JetFloatTypeMapping("single");
private readonly JetDoubleTypeMapping _double = new JetDoubleTypeMapping("double"); 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 JetCurrencyTypeMapping _currency = new JetCurrencyTypeMapping("currency");
private readonly JetDateTimeTypeMapping _datetime; private readonly JetDateTimeTypeMapping _datetime;
@ -181,14 +181,11 @@ namespace EntityFrameworkCore.Jet.Storage.Internal
{"timestamp", _rowversion}, {"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 _clrTypeMappings
= new Dictionary<Type, RelationalTypeMapping> = new Dictionary<Type, RelationalTypeMapping>
{ {
{typeof(bool), _bool}, {typeof(bool), _bool},
{typeof(byte), _byte}, {typeof(byte), _byte},
{typeof(sbyte), _smallint},
{typeof(short), _smallint}, {typeof(short), _smallint},
{typeof(int), _integer}, {typeof(int), _integer},
{typeof(long), _bigint}, {typeof(long), _bigint},

Loading…
Cancel
Save