private static void AddEntityConfigRecordsMappings(string mapperName, IEnumerable <EntityConfigRecord> entityConfigRecords)
 {
     MappingExtensions.AddConfiguration(mapperName, cfg =>
     {
         foreach (var r in entityConfigRecords)
         {
             var mtt = r.EndpointSettings.MapToType;
             if (mtt != r.Type)
             {
                 cfg.CreateMap(r.Type, r.EndpointSettings.MapToType);
                 cfg.CreateMap(r.EndpointSettings.MapToType, r.Type);
             }
             var mtptType = r.EndpointSettings.MapToPaginationType;
             var pType    = typeof(Pagination <>).MakeGenericType(mtt);
             if (mtptType != pType || mtptType != typeof(PaginationModel <>).MakeGenericType(mtt))
             {
                 cfg.CreateMap(pType, mtptType);
                 cfg.CreateMap(mtptType, pType);
             }
         }
     });
 }
        private static void AddDefaultMapping(string mapperName)
        {
            MappingExtensions.AddConfiguration(
                mapperName,
                cfg =>
            {
                cfg.CreateMap(typeof(Pagination <>), typeof(PaginationModel <>))
                .ForMember(
                    nameof(PaginationModel <IEntity> .Query),
                    opts => opts.MapFrom(nameof(Pagination <IEntity> .QueryOrFilter)));

                cfg.CreateMap(typeof(PaginationModel <>), typeof(Pagination <>))
                .ForMember(nameof(Pagination <IEntity> .QueryFunc), opts => opts.Ignore())
                .ForMember(nameof(Pagination <IEntity> .QueryOrFilter), opts => opts.MapFrom(nameof(PaginationModel <IEntity> .Query)));

                cfg.CreateMap <AuditRecord, AuditRecordModel>();
                cfg.CreateMap <AuditRecordModel, AuditRecord>();
                cfg.CreateMap <AuditPagination, AuditPaginationModel>();

                cfg.CreateMap(typeof(ServiceResponse <>), typeof(ServiceResponse <>));
            });
        }