fix(dal): Добавлен Trim для UnitService.GetByName для исключения ошибок длиблкатов ключа
This commit is contained in:
@@ -46,7 +46,7 @@ namespace PARR.AIHITMainSyncer.Services
|
|||||||
{
|
{
|
||||||
var isChanged = false;
|
var isChanged = false;
|
||||||
|
|
||||||
var unit = await unitService.GetUnitByName(objFromQuery.Name);
|
var unit = await unitService.GetByName(objFromQuery.Name);
|
||||||
|
|
||||||
foreach (var item in objFromQuery.Properties)
|
foreach (var item in objFromQuery.Properties)
|
||||||
{ //актуализируем справочники в соответствии с пришедшими данными
|
{ //актуализируем справочники в соответствии с пришедшими данными
|
||||||
@@ -134,7 +134,7 @@ namespace PARR.AIHITMainSyncer.Services
|
|||||||
else
|
else
|
||||||
logger.LogDebug($"----- Создан Unit: {unit.Name} -----");
|
logger.LogDebug($"----- Создан Unit: {unit.Name} -----");
|
||||||
|
|
||||||
return (await unitService.GetUnitByName(unit.Name))!;
|
return (await unitService.GetByName(unit.Name))!;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ namespace PARR.DAL.Services.Implementations.Unit
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public async Task<Models.Unit.Unit?> GetUnitByName(string name)
|
public async Task<Models.Unit.Unit?> GetByName(string name)
|
||||||
{
|
{
|
||||||
return await GetUnitWithFieldsAndValues()
|
return await GetUnitWithFieldsAndValues()
|
||||||
.FirstOrDefaultAsync(u => u.Name.ToLower() == name.ToLower());
|
.FirstOrDefaultAsync(u => u.Name.ToLower().Trim() == name.ToLower().Trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,6 @@ namespace PARR.DAL.Services.Interfaces.Unit
|
|||||||
{
|
{
|
||||||
public interface IUnitService : IBaseService<Models.Unit.Unit>
|
public interface IUnitService : IBaseService<Models.Unit.Unit>
|
||||||
{
|
{
|
||||||
Task<Models.Unit.Unit?> GetUnitByName(string name);
|
Task<Models.Unit.Unit?> GetByName(string name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user