duheng
2024-11-12 0bc0468692ad7b16cd2d49d20c4689ddcd6fb212
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
namespace HStation.Service
{
    public partial class AssetsThreelinkCoefficient
    {
        //Entity to GetModel
        internal static Model.AssetsThreelinkCoefficient Entity2Model(Entity.AssetsThreelinkCoefficient entity)
        {
            if (entity == null)
                return default;
            var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Entity.AssetsThreelinkCoefficient, Model.AssetsThreelinkCoefficient>()
             ).CreateMapper();
            var model = mapper.Map<Entity.AssetsThreelinkCoefficient, Model.AssetsThreelinkCoefficient>(entity);
            return model;
        }
 
        //Entities to GetModels
        internal static List<Model.AssetsThreelinkCoefficient> Entity2Models(List<Entity.AssetsThreelinkCoefficient> entities)
        {
            if (entities == null || entities.Count < 1)
                return default;
            var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Entity.AssetsThreelinkCoefficient, Model.AssetsThreelinkCoefficient>()
             ).CreateMapper();
            var models = mapper.Map<List<Entity.AssetsThreelinkCoefficient>, List<Model.AssetsThreelinkCoefficient>>(entities);
            return models;
        }
 
        //Model to Entity
        internal static Entity.AssetsThreelinkCoefficient Model2Entity(Model.AssetsThreelinkCoefficient model)
        {
            if (model == null)
                return default;
            var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.AssetsThreelinkCoefficient, Entity.AssetsThreelinkCoefficient>()
             ).CreateMapper();
            var entity = mapper.Map<Model.AssetsThreelinkCoefficient, Entity.AssetsThreelinkCoefficient>(model);
            return entity;
        }
 
        //Models to Entities
        internal static List<Entity.AssetsThreelinkCoefficient> Model2Entities(List<Model.AssetsThreelinkCoefficient> models)
        {
            if (models == null || models.Count < 1)
                return default;
            var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.AssetsThreelinkCoefficient, Entity.AssetsThreelinkCoefficient>()
             ).CreateMapper();
            var entities = mapper.Map<List<Model.AssetsThreelinkCoefficient>, List<Entity.AssetsThreelinkCoefficient>>(models);
            return entities;
        }
 
        //Model to Entity
        internal static void Model2Entity(Model.AssetsThreelinkCoefficient model, Entity.AssetsThreelinkCoefficient entity)
        {
            if (model == null || entity == null)
                return;
            var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.AssetsThreelinkCoefficient, Entity.AssetsThreelinkCoefficient>()
              ).CreateMapper();
            mapper.Map(model, entity);
        }
    }
}