Add Force DTOs

This commit is contained in:
Evgeny Redikultsev
2024-10-12 21:30:21 +05:00
parent 2c5c5db43a
commit 7e54aa0407
64 changed files with 1237 additions and 216 deletions

View File

@@ -18,9 +18,20 @@ namespace StructureHelperCommon.Infrastructures.Interfaces
public IConvertStrategy<T,V> ConvertStrategy { get; set; }
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
public DictionaryConvertStrategy(IBaseConvertStrategy baseConvertStrategy, IConvertStrategy<T, V> convertStrategy)
{
ReferenceDictionary = baseConvertStrategy.ReferenceDictionary;
TraceLogger = baseConvertStrategy.TraceLogger;
ConvertStrategy = convertStrategy;
}
public DictionaryConvertStrategy()
{
}
public T Convert(V source)
{
ICheckInputData();
CheckInputData();
T val;
var key = (source.Id, typeof(T));
if (ReferenceDictionary.ContainsKey(key))
@@ -38,7 +49,7 @@ namespace StructureHelperCommon.Infrastructures.Interfaces
}
return val;
}
private void ICheckInputData()
private void CheckInputData()
{
if(ReferenceDictionary is null)
{
@@ -47,6 +58,6 @@ namespace StructureHelperCommon.Infrastructures.Interfaces
throw new StructureHelperException(errorString);
}
}
}
}