2

I want to pass my query from Business Layer to Service Layer but when doing this i have to convert my DTO to Entity model.

Normally i can convert Type1 to Type2 via Autommaper but now i want to map Expression<Func<Type1,bool>> to Expression<Func<Type2, bool>>

I got error from Automapper

Missing type map configuration or unsupported mapping. 
Mapping types: Expression`1 -> Expression`1

How can i achieve this?

4

1 回答 1

2

I just updated my answer to the another question you commented on, which I think addresses this: AutoMapper for Func's between selector types

As for the error you posted above, that appears to be because you tried to map one Expression type to another with AutoMapper, e.g. Mapper.Map<Expression<Func<Type1,bool>>, Expression<Func<Type2, bool>>>(exp1, exp2). That sort of thing is not supported; AutoMapper is only for mapping between instances of different types, not expressions that deal with those types.

Anyway, if you read my other answer it may tell you how to achieve what you want.

于 2013-03-31T03:42:08.573 回答