diff --git a/DigitalData.Core.Application/BasicCRUDService.cs b/DigitalData.Core.Application/BasicCRUDService.cs
index 1586f07..c8d5835 100644
--- a/DigitalData.Core.Application/BasicCRUDService.cs
+++ b/DigitalData.Core.Application/BasicCRUDService.cs
@@ -27,10 +27,9 @@ namespace DigitalData.Core.Application
/// Initializes a new instance of the BasicCRUDService with the specified repository, translation service, and AutoMapper configuration.
///
/// The CRUD repository for accessing and manipulating entity data.
- /// The service used for key-based text translations, facilitating localization.
/// The AutoMapper instance for mapping between DTOs and entities.
- public BasicCRUDService(TCRUDRepository repository, IStringLocalizer defaultLocalizer, IMapper mapper) :
- base(repository, defaultLocalizer, mapper)
+ public BasicCRUDService(TCRUDRepository repository, IMapper mapper) :
+ base(repository, mapper)
{
}
}
diff --git a/DigitalData.Core.Application/CRUDService.cs b/DigitalData.Core.Application/CRUDService.cs
index 70e04a8..6aead52 100644
--- a/DigitalData.Core.Application/CRUDService.cs
+++ b/DigitalData.Core.Application/CRUDService.cs
@@ -3,7 +3,6 @@ using DigitalData.Core.Contracts.Infrastructure;
using AutoMapper;
using System.Reflection;
using System.ComponentModel.DataAnnotations;
-using Microsoft.Extensions.Localization;
using DigitalData.Core.DTO;
namespace DigitalData.Core.Application
@@ -22,23 +21,19 @@ namespace DigitalData.Core.Application
protected readonly TCRUDRepository _repository;
protected readonly IMapper _mapper;
protected readonly PropertyInfo? _keyPropertyInfo;
- protected readonly IStringLocalizer _localizer;
///
/// Initializes a new instance of the CRUDService class with the specified repository, translation service, and mapper.
///
/// The CRUD repository for accessing the database.
- /// The localizer for translating messages based on culture.
/// The AutoMapper instance for mapping between DTOs and entity objects.
- public CRUDService(TCRUDRepository repository, IStringLocalizer localizer, IMapper mapper)
+ public CRUDService(TCRUDRepository repository, IMapper mapper)
{
_repository = repository;
_mapper = mapper;
_keyPropertyInfo = typeof(TEntity).GetProperties()
.FirstOrDefault(prop => Attribute.IsDefined(prop, typeof(KeyAttribute)));
-
- _localizer = localizer;
}
///
@@ -62,7 +57,7 @@ namespace DigitalData.Core.Application
{
var entity = await _repository.ReadByIdAsync(id);
return entity is null
- ? Result.Fail().Message(_localizer[Key.EntityDoesNotExist])
+ ? Result.Fail()
: Result.Success(_mapper.MapOrThrow(entity));
}
@@ -86,7 +81,7 @@ namespace DigitalData.Core.Application
{
var entity = _mapper.MapOrThrow(updateDto);
bool isUpdated = await _repository.UpdateAsync(entity);
- return isUpdated ? Result.Success() : Result.Fail().Message(_localizer[Key.UpdateFailed]);
+ return isUpdated ? Result.Success() : Result.Fail();
}
///
@@ -99,10 +94,10 @@ namespace DigitalData.Core.Application
TEntity? entity = await _repository.ReadByIdAsync(id);
if (entity is null)
- return Result.Fail().Message(_localizer[Key.DeletionFailed], _localizer[Key.EntityDoesNotExist]);
+ return Result.Fail();
bool isDeleted = await _repository.DeleteAsync(entity);
- return isDeleted ? Result.Success() : Result.Fail().Message(_localizer[Key.DeletionFailed]);
+ return isDeleted ? Result.Success() : Result.Fail();
}
///
diff --git a/DigitalData.Core.Application/DirectorySearchService.cs b/DigitalData.Core.Application/DirectorySearchService.cs
index 8293a11..9fe3321 100644
--- a/DigitalData.Core.Application/DirectorySearchService.cs
+++ b/DigitalData.Core.Application/DirectorySearchService.cs
@@ -19,9 +19,8 @@ namespace DigitalData.Core.Application
public string SearchRootPath { get; }
private readonly DateTimeOffset _userCacheExpiration;
public Dictionary CustomSearchFilters { get; }
- protected readonly IStringLocalizer _localizer;
- public DirectorySearchService(IConfiguration configuration, ILogger logger, IMemoryCache memoryCache, IStringLocalizer localizer)
+ public DirectorySearchService(IConfiguration configuration, ILogger logger, IMemoryCache memoryCache)
{
_memoryCache = memoryCache;
@@ -39,8 +38,6 @@ namespace DigitalData.Core.Application
_userCacheExpiration = default;
else
_userCacheExpiration = DateTimeOffset.Now.Date.AddDays(dayCounts);
-
- _localizer = localizer;
}
public bool ValidateCredentials(string dirEntryUsername, string dirEntryPassword)
@@ -85,7 +82,7 @@ namespace DigitalData.Core.Application
_memoryCache.TryGetValue(username, out DirectoryEntry? searchRoot);
if (searchRoot is null)
- return Result.Fail>().Message(_localizer[Key.DirSearcherDisconnected]);
+ return Result.Fail>();
return FindAll(searchRoot, filter, searchScope, sizeLimit, properties);
}