AutoMapConfiguration.cs 868 B

123456789101112131415161718192021222324
  1. using AutoMapper;
  2. using SysDataLibs.TableClass;
  3. namespace Gs.TransData.WebApi.Helper
  4. {
  5. public class AutoMapConfiguration
  6. {
  7. public static void Configure()
  8. {
  9. Mapper.Initialize(cfg => { cfg.AddProfile<AutoMapProfile>(); });//增加对 ModelProfile的初始化
  10. Mapper.AssertConfigurationIsValid();
  11. }
  12. }
  13. public class AutoMapProfile: Profile
  14. {
  15. public AutoMapProfile()
  16. {
  17. CreateMap<CheckData_info, CheckData>().ForMember(a => a.CardIndex,b=>b.Ignore()).ForMember(a => a.LicenseNo, b => b.Ignore()).ForMember(a => a.IdCode, b => b.Ignore()).ForMember(a => a.UnitName, b => b.Ignore()).ForMember(a => a.PositionNo, b => b.Ignore()).ForMember(a => a.CorpNameName, b => b.Ignore());
  18. CreateMap<CheckData, CheckData_info>(); ;
  19. }
  20. }
  21. }