Lambda Expression

S

shapper

Hello,

I am using a third party assembly method as follows:

CreateMap<DocumentCreate, Document>()
.ForMember(d => d.Level.Id, o => o.MapFrom(s => s.Level));

And I get the following error:

Exception Details: System.ArgumentException: Expression 'd => Convert
(d.Level.Id)' must resolve to top-level member. Parameter name:
lambdaExpression

Is this a problem in my code? Am I missing something? (My code
compiles)

Thanks,
Miguel
 
P

Peter Duniho

Hello,

I am using a third party assembly method as follows:

CreateMap<DocumentCreate, Document>()
.ForMember(d => d.Level.Id, o => o.MapFrom(s => s.Level));

And I get the following error:

Exception Details: System.ArgumentException: Expression 'd => Convert
(d.Level.Id)' must resolve to top-level member. Parameter name:
lambdaExpression

You'll have to ask the author of the third party assembly. It appears
that they have some particular requirement as to the nature of the lambda
expression you use as the first argument for the ForMember() method. But
you didn't even show the method declaration for the ForMember() method,
never mind give us any information at all about it, never mind show its
code. There's no way for us to tell exactly what those requirements are.

But the author of the assembly can.

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top