Add converting beam shear analysis from DTOs

This commit is contained in:
Evgeny Redikultsev
2025-06-15 21:11:02 +05:00
parent 4845a35ba5
commit 87996cf37b
48 changed files with 992 additions and 105 deletions

View File

@@ -0,0 +1,30 @@
using StructureHelperCommon.Infrastructures.Exceptions;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Models.Shapes;
namespace DataAccess.DTOs
{
internal class ShapeFromDTOConvertStrategy : ConvertStrategy<IShape, IShape>
{
private IConvertStrategy<RectangleShape, RectangleShapeDTO> rectangleConvertStrategy;
public ShapeFromDTOConvertStrategy(IBaseConvertStrategy baseConvertStrategy) : base(baseConvertStrategy)
{
}
public override IShape GetNewItem(IShape source)
{
if (source is RectangleShapeDTO rectangleShapeDTO)
{
rectangleConvertStrategy ??= new DictionaryConvertStrategy<RectangleShape, RectangleShapeDTO>
(this, new RectangleShapeFromDTOConvertStrategy(this));
NewItem = rectangleConvertStrategy.Convert(rectangleShapeDTO);
}
else
{
throw new StructureHelperException(ErrorStrings.ObjectTypeIsUnknownObj(source) + ": shape is unknown");
}
return NewItem;
}
}
}