From: shapper on
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


From: Peter Duniho on
On Tue, 22 Sep 2009 03:41:23 -0700, shapper <mdmoura(a)gmail.com> wrote:

> 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