Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7071753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:43:33+00:00 2026-05-28T05:43:33+00:00

I have this mapping defined in my Application Layer: public IList<ProfessionDTO> GetAllProfessions() { IList<Profession>

  • 0

I have this mapping defined in my Application Layer:

public IList<ProfessionDTO> GetAllProfessions()
{
    IList<Profession> professions = _professionRepository.GetAll();
    Mapper.CreateMap<Profession, ProfessionDTO>();
    Mapper.CreateMap<IList<Profession>, IList<ProfessionDTO>>();
    IList<ProfessionDTO> professionsDto = Mapper.Map<IList<Profession>, IList<ProfessionDTO>>(professions);
    return professionsDto;
}

Proffesion entity

 public class Profession
    {
        private int _id;
        private string _name;


        private Profession(){} // required by nHibernate

        public Profession(int id, string name)
        {
            ParameterValidator.NotNull(id, "id is required.");
            ParameterValidator.NotNull(name, "name is required.");
            _id = id;
            _name = name;
        }

        public string Name
        {
            get { return _name; }
        }

        public int Id
        {
            get { return _id; }
        }
    }

Profession DTO:

public class ProfessionDTO
{
    public int Id { get; set; }
    public string Name { get; set; }
}

When executing GetAllProfessions I get this error:

Signature of the body and declaration in a method implementation do not match.

Any idea why is it happening?

I have just changed all the IList to List. I don’t get the exception now but the List of 27 entities of Profession that is retrieved is mapped to 0 of ProfessionDTO.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:43:34+00:00Added an answer on May 28, 2026 at 5:43 am

    I feel silly answering my own question.

    I don’t need this line:

    Mapper.CreateMap<IList<Profession>, IList<ProfessionDTO>>();
    

    Now Auomapper works perfectly!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a mapping application written in a flex/flash app. This app is used
I have a relation mapping table like this: attributeid bigint productid bigint To clean
I have a Hibernate mapping that looks something like this: <class name=MyEntity> <set name=scalarSet
I used the mapping solution from this question to have a joined component. But
This is JavaScript regex. regex = /(http:\/\/[^\s]*)/g; text = I have http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd and I
NHibernate is driving me 'Nuts'!!! I have the following mapping. Which returns this error
I have this idea for a free backup application. The largest problem I need
I have implemented URL mapping in our ASP.NET 4 application, but I have a
in my current rails application I have a bunch of named routes defined to
Ok, I have an application that uses a mapping system to draw lines. Each

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.