Bug fix: Missing Singleton

This commit is contained in:
Mike Phares 2024-05-25 10:27:10 -07:00
parent f53ae8c1c8
commit 3aed250488

View File

@ -2,7 +2,6 @@ using OI.Metrology.Wafer.Counter.Models;
using OI.Metrology.Shared.DataModels; using OI.Metrology.Shared.DataModels;
using OI.Metrology.Shared.Models; using OI.Metrology.Shared.Models;
using OI.Metrology.Shared.Models.Stateless; using OI.Metrology.Shared.Models.Stateless;
using OI.Metrology.Shared.Repositories;
using System.Globalization; using System.Globalization;
namespace OI.Metrology.Wafer.Counter.Repository; namespace OI.Metrology.Wafer.Counter.Repository;
@ -18,15 +17,13 @@ public class WaferCounterRepository : IWaferCounterRepository
private readonly string _RepositoryName; private readonly string _RepositoryName;
private readonly AppSettings _AppSettings; private readonly AppSettings _AppSettings;
private readonly IHttpClientFactory _HttpClientFactory; private readonly IHttpClientFactory _HttpClientFactory;
private readonly IDbConnectionFactory _DBConnectionFactory;
private readonly IFileShareRepository _FileShareRepository; private readonly IFileShareRepository _FileShareRepository;
public WaferCounterRepository(AppSettings appSettings, IDbConnectionFactory dbConnectionFactory, IHttpClientFactory httpClientFactory, IFileShareRepository fileShareRepository) public WaferCounterRepository(AppSettings appSettings, IHttpClientFactory httpClientFactory, IFileShareRepository fileShareRepository)
{ {
_AppSettings = appSettings; _AppSettings = appSettings;
_MockRoot = appSettings.MockRoot; _MockRoot = appSettings.MockRoot;
_HttpClientFactory = httpClientFactory; _HttpClientFactory = httpClientFactory;
_DBConnectionFactory = dbConnectionFactory;
_FileShareRepository = fileShareRepository; _FileShareRepository = fileShareRepository;
_RepositoryName = nameof(WaferCounterRepository)[..^10]; _RepositoryName = nameof(WaferCounterRepository)[..^10];
} }
@ -163,7 +160,7 @@ public class WaferCounterRepository : IWaferCounterRepository
if (string.IsNullOrEmpty(record.SlotMap) || record.SlotMap.Length != 25) if (string.IsNullOrEmpty(record.SlotMap) || record.SlotMap.Length != 25)
throw new Exception("Wrong length for slot-map!"); throw new Exception("Wrong length for slot-map!");
if (record.Total != record.Check) if (record.Total != record.Check)
throw new Exception($"Invalid {record.Total} != {record.Check}"); throw new Exception($"Checksum has failed. {record.Total} != {record.Check}");
result = new(nginxFileSystemSortable.DateTime, nginxFileSystemSortable.DateTime.ToString("yyyy-MM-dd hh:mm tt"), $"WC{waferSize}{equipmentId}", text, record.Total, record.SlotMap); result = new(nginxFileSystemSortable.DateTime, nginxFileSystemSortable.DateTime.ToString("yyyy-MM-dd hh:mm tt"), $"WC{waferSize}{equipmentId}", text, record.Total, record.SlotMap);
return result; return result;
} }