Files
StructureHelper/DataAccess/DTOs/Converters/FileVersionFromDTOConvertStrategy.cs
Evgeny Redikultsev c10d6eb94e Add VisualAnalysisDTO
2024-09-14 19:03:35 +05:00

31 lines
1.1 KiB
C#

using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models;
using StructureHelperCommon.Models.Projects;
namespace DataAccess.DTOs
{
public class FileVersionFromDTOConvertStrategy : IConvertStrategy<FileVersion, FileVersionDTO>
{
private IUpdateStrategy<IFileVersion> updateStrategy;
public IShiftTraceLogger TraceLogger { get; set; }
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public FileVersionFromDTOConvertStrategy(IUpdateStrategy<IFileVersion> updateStrategy)
{
this.updateStrategy = updateStrategy;
}
public FileVersionFromDTOConvertStrategy() : this(new FileVersionUpdateStrategy())
{
}
public FileVersion Convert(FileVersionDTO source)
{
FileVersion fileVersion = new(source.Id);
updateStrategy.Update(fileVersion, source);
return fileVersion;
}
}
}