mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 09:11:10 +00:00
Replaces reflection-based repository instantiation with unit of work property accessors
This commit is contained in:
1 parent
4fa9eb6e26
commit
fee14afb89
87 files changed
+541
-735
No files matched your search
@@ -50,7 +50,6 @@ internal sealed class PluginDetectionSyncJob : BackgroundService
|
||||
|
||||
await using AsyncServiceScope asyncServiceScope = _serviceScopeFactory.CreateAsyncScope();
|
||||
IUnitOfWork unitOfWork = asyncServiceScope.ServiceProvider.GetRequiredService<IUnitOfWork>();
|
||||
IPluginRepository pluginRepository = unitOfWork.GetRepository<IPluginRepository>();
|
||||
|
||||
foreach (IPlugin plugin in _pluginManager.GetPlugins())
|
||||
{
|
||||
@@ -66,7 +65,7 @@ internal sealed class PluginDetectionSyncJob : BackgroundService
|
||||
CreatedBy = default,
|
||||
UpdatedBy = default
|
||||
};
|
||||
Result<Updated> upsertResult = await pluginRepository.UpsertAsync(pluginEntity, stoppingToken).ConfigureAwait(false);
|
||||
Result<Updated> upsertResult = await unitOfWork.PluginRepository.UpsertAsync(pluginEntity, stoppingToken).ConfigureAwait(false);
|
||||
if (upsertResult.IsFailure)
|
||||
_logger.LogError("Failed to persist the detection of plugin '{PluginName}': {Error}", plugin.Name, upsertResult.FirstError.Description);
|
||||
}
|
||||
|
||||
@@ -36,8 +36,7 @@ internal sealed class PluginSettingsStore : IPluginSettingsStore
|
||||
/// <inheritdoc/>
|
||||
public async Task<IReadOnlyDictionary<string, string>?> GetSettingsAsync(Guid pluginId, CancellationToken cancellationToken)
|
||||
{
|
||||
IPluginRepository pluginRepository = _unitOfWork.GetRepository<IPluginRepository>();
|
||||
Result<PluginEntity?> getPluginResult = await pluginRepository.GetByIdAsync(pluginId, cancellationToken).ConfigureAwait(false);
|
||||
Result<PluginEntity?> getPluginResult = await _unitOfWork.PluginRepository.GetByIdAsync(pluginId, cancellationToken).ConfigureAwait(false);
|
||||
if (getPluginResult.IsFailure)
|
||||
{
|
||||
_logger.LogWarning("Failed to read the settings of the plugin with Id '{PluginId}': {Error}", pluginId, getPluginResult.FirstError.Description);
|
||||
|
||||
Reference in new issue
Block a user