Workaround unsigned fields in database unsupported by EntityFramework 6.

This commit is contained in:
2018-12-23 18:49:07 +00:00
parent 30d4e4bb31
commit dcbdf9d59a
2 changed files with 384 additions and 169 deletions

View File

@@ -996,6 +996,38 @@ namespace DiscImageChef.CommonTypes.Metadata
public string Organization { get; set; }
public string Name { get; set; }
public string Description { get; set; }
[JsonIgnore]
[XmlIgnore]
public int BitsPerMmSql
{
get => (int)BitsPerMm;
set => BitsPerMm = (uint)value;
}
[JsonIgnore]
[XmlIgnore]
public short WidthSql
{
get => (short)Width;
set => Width = (ushort)value;
}
[JsonIgnore]
[XmlIgnore]
public short TracksSql
{
get => (short)Tracks;
set => Tracks = (ushort)value;
}
[JsonIgnore]
[XmlIgnore]
public int CapacitySql
{
get => (int)Capacity;
set => Capacity = (uint)value;
}
}
public class SupportedMedia

View File

@@ -45,6 +45,7 @@ using DiscImageChef.Decoders.ATA;
using DiscImageChef.Decoders.SCSI;
using DiscImageChef.Decoders.SCSI.MMC;
using Newtonsoft.Json;
// ReSharper disable VirtualMemberNeverOverridden.Global
// ReSharper disable VirtualMemberCallInConstructor
@@ -156,6 +157,20 @@ namespace DiscImageChef.CommonTypes.Metadata
public string Product { get; set; }
public bool RemovableMedia { get; set; }
public byte[] Descriptors { get; set; }
[JsonIgnore]
public short VendorIDSql
{
get => (short)VendorID;
set => VendorID = (ushort)value;
}
[JsonIgnore]
public short ProductIDSql
{
get => (short)ProductID;
set => ProductID = (ushort)value;
}
}
public class FireWire
@@ -178,6 +193,20 @@ namespace DiscImageChef.CommonTypes.Metadata
public string Manufacturer { get; set; }
public string Product { get; set; }
public bool RemovableMedia { get; set; }
[JsonIgnore]
public int VendorIDSql
{
get => (int)VendorID;
set => VendorID = (uint)value;
}
[JsonIgnore]
public int ProductIDSql
{
get => (int)ProductID;
set => ProductID = (uint)value;
}
}
public class Ata
@@ -395,6 +424,25 @@ namespace DiscImageChef.CommonTypes.Metadata
public ushort Cylinders { get; set; }
public ushort Heads { get; set; }
public ushort Sectors { get; set; }
[JsonIgnore]
public short CylindersSql
{
get => (short)Cylinders;
set => Cylinders = (ushort)value;
}
[JsonIgnore]
public short HeadsSql
{
get => (short)Heads;
set => Heads = (ushort)value;
}
[JsonIgnore]
public short SectorsSql
{
get => (short)Sectors;
set => Sectors = (ushort)value;
}
}
public class Scsi
@@ -578,6 +626,19 @@ namespace DiscImageChef.CommonTypes.Metadata
public byte Density { get; set; }
public ulong? Blocks { get; set; }
public uint? BlockLength { get; set; }
[JsonIgnore]
public long? BlocksSql
{
get => (long?)Blocks;
set => Blocks = (ulong?)value;
}
[JsonIgnore]
public int? BlockLengthSql
{
get => (int?)BlockLength;
set => BlockLength = (uint?)value;
}
}
public class ScsiPage
@@ -686,8 +747,8 @@ namespace DiscImageChef.CommonTypes.Metadata
public MmcFeatures(mmcFeaturesType features)
{
if(features.PhysicalInterfaceStandardSpecified)
PhysicalInterfaceStandard = features.PhysicalInterfaceStandard;
if(features.PhysicalInterfaceStandardSpecified && !features.PhysicalInterfaceStandardNumberSpecified)
PhysicalInterfaceStandardNumber = (uint?)features.PhysicalInterfaceStandard;
if(features.PhysicalInterfaceStandardNumberSpecified)
PhysicalInterfaceStandardNumber = features.PhysicalInterfaceStandardNumber;
@@ -926,12 +987,13 @@ namespace DiscImageChef.CommonTypes.Metadata
public bool DVDMultiRead { get; set; }
public bool EmbeddedChanger { get; set; }
public bool ErrorRecoveryPage { get; set; }
public virtual DateTime? FirmwareDate { get; set; }
public DateTime? FirmwareDate { get; set; }
public byte? LoadingMechanismType { get; set; }
public bool Locked { get; set; }
public uint? LogicalBlockSize { get; set; }
public bool MultiRead { get; set; }
public virtual PhysicalInterfaces? PhysicalInterfaceStandard { get; set; }
public PhysicalInterfaces? PhysicalInterfaceStandard =>
(PhysicalInterfaces?)PhysicalInterfaceStandardNumber;
public uint? PhysicalInterfaceStandardNumber { get; set; }
public bool PreventJumper { get; set; }
public bool SupportsAACS { get; set; }
@@ -952,6 +1014,30 @@ namespace DiscImageChef.CommonTypes.Metadata
public bool SupportsWriteInhibitDCB { get; set; }
public bool SupportsWriteProtectPAC { get; set; }
public ushort? VolumeLevels { get; set; }
[JsonIgnore]
public short? BlocksPerReadableUnitSql
{
get => (short?)BlocksPerReadableUnit;
set => BlocksPerReadableUnit = (ushort?)value;
}
[JsonIgnore]
public int? LogicalBlockSizeSql
{
get => (int?)LogicalBlockSize;
set => LogicalBlockSize = (uint?)value;
}
[JsonIgnore]
public int? PhysicalInterfaceStandardNumberSql
{
get => (int?)PhysicalInterfaceStandardNumber;
set => PhysicalInterfaceStandardNumber = (uint?)value;
}
[JsonIgnore]
public short? VolumeLevelsSql
{
get => (short?)VolumeLevels;
set => VolumeLevels = (ushort?)value;
}
}
public class TestedMedia
@@ -1231,6 +1317,67 @@ namespace DiscImageChef.CommonTypes.Metadata
public bool? SupportsReadSectors { get; set; }
public bool? SupportsReadLongRetry { get; set; }
public bool? SupportsSeek { get; set; }
[JsonIgnore]
public long? BlocksSql
{
get => (long?)Blocks;
set => Blocks = (ulong?)value;
}
[JsonIgnore]
public int? BlockSizeSql
{
get => (int?)BlockSize;
set => BlockSize = (uint?)value;
}
[JsonIgnore]
public int? LongBlockSizeSql
{
get => (int?)LongBlockSize;
set => LongBlockSize = (uint?)value;
}
[JsonIgnore]
public int? LBASectorsSql
{
get => (int?)LBASectors;
set => LBASectors = (uint?)value;
}
[JsonIgnore]
public long? LBA48SectorsSql
{
get => (long?)LBA48Sectors;
set => LBA48Sectors = (ulong?)value;
}
[JsonIgnore]
public short? LogicalAlignmentSql
{
get => (short?)LogicalAlignment;
set => LogicalAlignment = (ushort?)value;
}
[JsonIgnore]
public short? NominalRotationRateSql
{
get => (short?)NominalRotationRate;
set => NominalRotationRate = (ushort?)value;
}
[JsonIgnore]
public int? PhysicalBlockSizeSql
{
get => (int?)PhysicalBlockSize;
set => PhysicalBlockSize = (uint?)value;
}
[JsonIgnore]
public short? UnformattedBPTSql
{
get => (short?)UnformattedBPT;
set => UnformattedBPT = (ushort?)value;
}
[JsonIgnore]
public short? UnformattedBPSSql
{
get => (short?)UnformattedBPS;
set => UnformattedBPS = (ushort?)value;
}
}
public class Ssc
@@ -1268,6 +1415,18 @@ namespace DiscImageChef.CommonTypes.Metadata
public virtual List<SupportedDensity> SupportedDensities { get; set; }
public virtual List<SscSupportedMedia> SupportedMediaTypes { get; set; }
public virtual List<TestedSequentialMedia> TestedMedia { get; set; }
[JsonIgnore]
public int? MaxBlockLengthSql
{
get => (int?)MaxBlockLength;
set => MaxBlockLength = (uint?)value;
}
[JsonIgnore]
public int? MinBlockLengthSql
{
get => (int?)MinBlockLength;
set => MinBlockLength = (uint?)value;
}
}
public class TestedSequentialMedia
@@ -1338,6 +1497,18 @@ namespace DiscImageChef.CommonTypes.Metadata
public ushort? CardCode { get; set; }
public string Manufacturer { get; set; }
public string ProductName { get; set; }
[JsonIgnore]
public short? ManufacturerCodeSql
{
get => (short?)ManufacturerCode;
set => ManufacturerCode = (ushort?)value;
}
[JsonIgnore]
public short? CardCodeSql
{
get => (short?)CardCode;
set => CardCode = (ushort?)value;
}
}
public class MmcSd
@@ -1389,6 +1560,18 @@ namespace DiscImageChef.CommonTypes.Metadata
public string Organization { get; set; }
public string Name { get; set; }
public string Description { get; set; }
[JsonIgnore]
public short WidthSql
{
get => (short)Width;
set => Width = (ushort)value;
}
[JsonIgnore]
public short LengthSql
{
get => (short)Length;
set => Length = (ushort)value;
}
}
public class DensityCode