Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

[AutoMapTo(typeof(Person))] #4519


User avatar
0
avanekar02 created

Error becuase this line , which assembly is to be added to address this, log file shows this error.

-----------------------------------------------------------Logs.txt----------- ERROR 2018-01-16 22:29:34,451 [31 ] Mvc.ExceptionHandling.AbpExceptionFilter - Unmapped members were found. Review the types and members below. Add a custom mapping expression, ignore, add a custom resolver, or modify the source/destination type For no matching constructor, add a no-arg ctor, add optional arguments, or map all of the constructor parameters

CreatePersonInput -> Person (Destination member list) Noor.ClassMateDemo.ClassMate.Dto.CreatePersonInput -> Noor.ClassMateDemo.ClassMate.Person (Destination member list)

Unmapped properties: IsDeleted DeleterUserId DeletionTime LastModificationTime LastModifierUserId CreationTime CreatorUserId Id

AutoMapper.AutoMapperConfigurationException: Unmapped members were found. Review the types and members below. Add a custom mapping expression, ignore, add a custom resolver, or modify the source/destination type For no matching constructor, add a no-arg ctor, add optional arguments, or map all of the constructor parameters

CreatePersonInput -> Person (Destination member list) Noor.ClassMateDemo.ClassMate.Dto.CreatePersonInput -> Noor.ClassMateDemo.ClassMate.Person (Destination member list)

Unmapped properties: IsDeleted DeleterUserId DeletionTime LastModificationTime LastModifierUserId CreationTime CreatorUserId Id

at AutoMapper.ConfigurationValidator.AssertConfigurationIsValid(IEnumerable`1 typeMaps) at AutoMapper.MapperConfiguration.AssertConfigurationIsValid(TypeMap typeMap) at lambda_method(Closure , CreatePersonInput , Person , ResolutionContext ) at lambda_method(Closure , Object , Object , ResolutionContext ) at AutoMapper.Mapper.AutoMapper.IMapper.Map[TDestination](Object source) at Abp.AutoMapper.AutoMapperObjectMapper.Map[TDestination](Object source) at Noor.ClassMateDemo.ClassMate.PersonAppService.


10 Answer(s)
  • User Avatar
    0
    aaron created
    Support Team

    Duplicate of #4367@4a050a71-139c-436b-a11c-63f170c486d1

    Can you show the definition of CreatePersonInput and Person?

  • User Avatar
    0
    avanekar02 created

    using System.ComponentModel.DataAnnotations;

    namespace Noor.ClassMateDemo.ClassMate.Dto {

    public class CreatePersonInput
    {
        [Required]
        [MaxLength(PersonConsts.MaxNameLength)]
        public string Name { get; set; }
    
        [Required]
        [MaxLength(PersonConsts.MaxSurnameLength)]
        public string Surname { get; set; }
    
        [EmailAddress]
        [MaxLength(PersonConsts.MaxEmailAddressLength)]
        public string EmailAddress { get; set; }
    }
    

    }

    using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Abp.Domain.Entities; using Abp.Domain.Entities.Auditing;

    namespace Noor.ClassMateDemo.ClassMate { [Table("PbPersons")] public class Person : FullAuditedEntity { [Required] [MaxLength(PersonConsts.MaxNameLength)] public virtual string Name { get; set; }

        [Required]
        [MaxLength(PersonConsts.MaxSurnameLength)]
        public virtual string Surname { get; set; }
    
        [MaxLength(PersonConsts.MaxEmailAddressLength)]
        public virtual string EmailAddress { get; set; }
    
    
    }
    

    }

    using System; using System.Collections.Generic; using System.Text;

    namespace Noor.ClassMateDemo.ClassMate { public class PersonConsts { public const int MaxNameLength = 32; public const int MaxSurnameLength = 32; public const int MaxEmailAddressLength = 255; } }

  • User Avatar
    0
    avanekar02 created

    you see in the downloaded solution there is no " [AutoMapTo(typeof(Person))]" used in my solution however i added the automapto see the screenshot please

  • User Avatar
    0
    aaron created
    Support Team
    • Which version of Abp.AutoMapper package are you using?
    • Why are there red squiggly lines?
  • User Avatar
    0
    avanekar02 created

    The dependencies "Acme.PhoneBookDemo.Core.Shared" you will see the difference between the downloaded Acme.PhoneBookDemo app and my app as the image sent previously.

  • User Avatar
    0
    aaron created
    Support Team

    Did you mean that:

    • in "Acme.PhoneBookDemo.Application.Shared", CreatePersonInput does not have [AutoMapTo(typeof(Person))], and
    • adding it will fix the error?
  • User Avatar
    0
    avanekar02 created

    cannot add Abp.Automapper as the project in demo references SDK net461 and netstandard library but the project that i generated only references .netstandardlibrary no reference to sdk net461 is found.

    Regards Anwar

  • User Avatar
    0
    aaron created
    Support Team

    You should not need to reference net461 as Abp.AutoMapper targets netstandard2.0.

  • User Avatar
    0
    avanekar02 created

    <cite>aaron: </cite> You should not need to reference net461 as Abp.AutoMapper targets netstandard2.0.

    aron,

    thanks for your response

    dear aaron i have put the dependencies of the demo project and my project maaybe this will give a clearer picture

  • User Avatar
    0
    aaron created
    Support Team

    Are there any errors?