Add Safety FactorConverter
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Infrastructures.Exceptions;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
@@ -12,12 +13,38 @@ namespace DataAccess.DTOs.Converters
|
||||
{
|
||||
internal class HelperMaterialToDTOConvertStrategy : IConvertStrategy<IHelperMaterial, IHelperMaterial>
|
||||
{
|
||||
private IConvertStrategy<ConcreteLibMaterialDTO, IConcreteLibMaterial> concreteConvertStrategy;
|
||||
public Dictionary<(Guid id, Type type), ISaveable> ReferenceDictionary { get; set; }
|
||||
public IShiftTraceLogger TraceLogger { get; set; }
|
||||
|
||||
public HelperMaterialToDTOConvertStrategy(
|
||||
IConvertStrategy<ConcreteLibMaterialDTO, IConcreteLibMaterial> concreteConvertStrategy)
|
||||
{
|
||||
this.concreteConvertStrategy = concreteConvertStrategy;
|
||||
}
|
||||
|
||||
public HelperMaterialToDTOConvertStrategy() : this (new ConcreteLibMaterialToDTOConvertStrategy())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public IHelperMaterial Convert(IHelperMaterial source)
|
||||
{
|
||||
Check();
|
||||
if (source is IConcreteLibMaterial concreteLibMaterial)
|
||||
{
|
||||
concreteConvertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||
concreteConvertStrategy.TraceLogger = TraceLogger;
|
||||
return concreteConvertStrategy.Convert(concreteLibMaterial);
|
||||
}
|
||||
if (source is IReinforcementLibMaterial reinforcementMaterial)
|
||||
{
|
||||
return source;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source));
|
||||
}
|
||||
}
|
||||
|
||||
private void Check()
|
||||
|
||||
Reference in New Issue
Block a user