56 lines
1.6 KiB
C#
56 lines
1.6 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
|
|
using BS.Shared;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts.Feature.AI;
|
|
|
|
namespace BeWo.Service.DCEntityMapper
|
|
{
|
|
public class AiConfigDC_AiConfig : AbstractIDCEntityMapper<AiConfig, AiConfigDC>
|
|
{
|
|
public override AiConfigDC MergeWithDC(AiConfig pEntity, AiConfigDC pDataContract)
|
|
{
|
|
pDataContract.Oid = pEntity.Oid;
|
|
pDataContract.Version = pEntity.Version;
|
|
pDataContract.Notice = pEntity.Notice;
|
|
pDataContract.Temperature = pEntity.Temperature;
|
|
pDataContract.Top_P = pEntity.Top_P;
|
|
pDataContract.Max_Gen_Len = pEntity.Max_Gen_Len;
|
|
pDataContract.Context_Type = pEntity.Context_Type;
|
|
|
|
pDataContract.SelectedModel = MapperFactory.AiModel.CreateOrMapToNewDC(pEntity.SelectedModel, true);
|
|
|
|
return pDataContract;
|
|
}
|
|
|
|
public override AiConfig MergeWithEntity(AiConfigDC pDataContract, AiConfig pEntity)
|
|
{
|
|
ConcurrencyCheck(pDataContract.Version, pEntity);
|
|
|
|
pEntity.Oid = pDataContract.Oid;
|
|
pEntity.Version = pDataContract.Version;
|
|
pEntity.Notice = pDataContract.Notice;
|
|
pEntity.Temperature = pDataContract.Temperature;
|
|
pEntity.Top_P = pDataContract.Top_P;
|
|
pEntity.Max_Gen_Len = pDataContract.Max_Gen_Len;
|
|
pEntity.Context_Type = pDataContract.Context_Type;
|
|
|
|
if (pDataContract.SelectedModel?.Oid is long oid)
|
|
pEntity.SelectedModel = DAOFactory.GenericDAO.LoadByID<AiModel>(oid);
|
|
else
|
|
pEntity.SelectedModel = null;
|
|
|
|
return pEntity;
|
|
}
|
|
|
|
protected override bool AreDCAndEntityEqual(AiConfigDC pDC, AiConfig pEntity)
|
|
{
|
|
throw new System.NotImplementedException();
|
|
}
|
|
}
|
|
}
|