1234567891011121314151617181920212223242526 |
- using AutoMapper;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace MTWorkHR.Application.MappingProfiles
- {
- public class MapperObject
- {
- private static readonly Lazy<IMapper> Lazy = new Lazy<IMapper>(() =>
- {
- var config = new MapperConfiguration(cfg =>
- {
- cfg.ShouldMapProperty = p => p.GetMethod.IsPublic || p.GetMethod.IsAssembly;
- cfg.AddProfile<MappingProfile>();
- });
- var mapper = config.CreateMapper();
- return mapper;
- });
- public static IMapper Mapper => Lazy.Value;
- }
- }
|