lixiaojun
2024-12-12 fe59cb0e4d060664927dca75d453162deae3e17d
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 AssetsExchangerMainAndPartMapping
    {
        //Entity to GetModel
        internal static Model.AssetsExchangerMainAndPartMapping Entity2Model(Entity.AssetsExchangerMainAndPartMapping entity)
        {
            if (entity == null)
                return default;
            var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Entity.AssetsExchangerMainAndPartMapping, Model.AssetsExchangerMainAndPartMapping>()
             ).CreateMapper();
            var model = mapper.Map<Entity.AssetsExchangerMainAndPartMapping, Model.AssetsExchangerMainAndPartMapping>(entity);
            return model;
        }
 
        //Entities to GetModels
        internal static List<Model.AssetsExchangerMainAndPartMapping> Entity2Models(List<Entity.AssetsExchangerMainAndPartMapping> entities)
        {
            if (entities == null || entities.Count < 1)
                return default;
            var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Entity.AssetsExchangerMainAndPartMapping, Model.AssetsExchangerMainAndPartMapping>()
             ).CreateMapper();
            var models = mapper.Map<List<Entity.AssetsExchangerMainAndPartMapping>, List<Model.AssetsExchangerMainAndPartMapping>>(entities);
            return models;
        }
 
        //Model to Entity
        internal static Entity.AssetsExchangerMainAndPartMapping Model2Entity(Model.AssetsExchangerMainAndPartMapping model)
        {
            if (model == null)
                return default;
            var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.AssetsExchangerMainAndPartMapping, Entity.AssetsExchangerMainAndPartMapping>()
             ).CreateMapper();
            var entity = mapper.Map<Model.AssetsExchangerMainAndPartMapping, Entity.AssetsExchangerMainAndPartMapping>(model);
            return entity;
        }
 
        //Models to Entities
        internal static List<Entity.AssetsExchangerMainAndPartMapping> Model2Entities(List<Model.AssetsExchangerMainAndPartMapping> models)
        {
            if (models == null || models.Count < 1)
                return default;
            var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.AssetsExchangerMainAndPartMapping, Entity.AssetsExchangerMainAndPartMapping>()
             ).CreateMapper();
            var entities = mapper.Map<List<Model.AssetsExchangerMainAndPartMapping>, List<Entity.AssetsExchangerMainAndPartMapping>>(models);
            return entities;
        }
 
        //Model to Entity
        internal static void Model2Entity(Model.AssetsExchangerMainAndPartMapping model, Entity.AssetsExchangerMainAndPartMapping entity)
        {
            if (model == null || entity == null)
                return;
            var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Model.AssetsExchangerMainAndPartMapping, Entity.AssetsExchangerMainAndPartMapping>()
              ).CreateMapper();
            mapper.Map(model, entity);
        }
    }
}