Add beam shear clone strategies
This commit is contained in:
@@ -1,35 +1,16 @@
|
||||
using DataAccess.DTOs.Converters;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Infrastructures.Settings;
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Models;
|
||||
using StructureHelperCommon.Models.Analyses;
|
||||
using StructureHelperCommon.Models.Loggers;
|
||||
using StructureHelperCommon.Models.Projects;
|
||||
using StructureHelperLogic.Models.Analyses;
|
||||
using StructureHelperLogics.Models.CrossSections;
|
||||
using StructureHelperLogics.NdmCalculations.Analyses.ByForces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
//Copyright (c) 2025 Redikultsev Evgeny, Ekaterinburg, Russia
|
||||
//All rights reserved.
|
||||
|
||||
namespace DataAccess.DTOs
|
||||
{
|
||||
internal class VisualAnalysisToDTOConvertStrategy : ConvertStrategy<VisualAnalysisDTO, IVisualAnalysis>
|
||||
{
|
||||
private IConvertStrategy<IAnalysis, IAnalysis> convertStrategy;
|
||||
|
||||
public VisualAnalysisToDTOConvertStrategy(IConvertStrategy<IAnalysis, IAnalysis> convertStrategy)
|
||||
{
|
||||
this.convertStrategy = convertStrategy;
|
||||
}
|
||||
|
||||
public VisualAnalysisToDTOConvertStrategy() : this(new AnalysisToDTOConvertStrategy())
|
||||
{
|
||||
|
||||
}
|
||||
private IConvertStrategy<IAnalysis, IAnalysis> convertLogic;
|
||||
|
||||
public override VisualAnalysisDTO GetNewItem(IVisualAnalysis source)
|
||||
{
|
||||
@@ -40,30 +21,29 @@ namespace DataAccess.DTOs
|
||||
return visualAnalysisDTO;
|
||||
}
|
||||
|
||||
public VisualAnalysisToDTOConvertStrategy
|
||||
(Dictionary<(Guid id, Type type), ISaveable> referenceDictionary,
|
||||
IShiftTraceLogger traceLogger)
|
||||
: base(referenceDictionary, traceLogger)
|
||||
{
|
||||
}
|
||||
|
||||
private VisualAnalysisDTO GetNewAnalysis(IVisualAnalysis source)
|
||||
{
|
||||
VisualAnalysisDTO visualAnalysisDTO = new()
|
||||
InitializeStrategies();
|
||||
VisualAnalysisDTO visualAnalysisDTO = new(source.Id)
|
||||
{
|
||||
Id = source.Id
|
||||
Analysis = convertLogic.Convert(source.Analysis)
|
||||
};
|
||||
convertStrategy.ReferenceDictionary = ReferenceDictionary;
|
||||
convertStrategy.TraceLogger = TraceLogger;
|
||||
var convertLogic = new DictionaryConvertStrategy<IAnalysis, IAnalysis>(this, convertStrategy)
|
||||
{
|
||||
ReferenceDictionary = ReferenceDictionary,
|
||||
ConvertStrategy = convertStrategy,
|
||||
TraceLogger = TraceLogger
|
||||
};
|
||||
visualAnalysisDTO.Analysis = convertLogic.Convert(source.Analysis);
|
||||
return visualAnalysisDTO;
|
||||
}
|
||||
|
||||
private void Check()
|
||||
private void InitializeStrategies()
|
||||
{
|
||||
var checkLogic = new CheckConvertLogic<VisualAnalysisDTO, IVisualAnalysis>();
|
||||
checkLogic.ConvertStrategy = this;
|
||||
checkLogic.TraceLogger = TraceLogger;
|
||||
checkLogic.Check();
|
||||
convertLogic ??= new DictionaryConvertStrategy<IAnalysis, IAnalysis>
|
||||
(this,
|
||||
new AnalysisToDTOConvertStrategy(ReferenceDictionary, TraceLogger)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user