How to ignore certain Collection object mappings when mapping two different collections?

139 vistas
Ir al primer mensaje no leído

laan...@gmail.com

no leída,
18 may 2015, 12:18:07 p.m.18/5/15
para automapp...@googlegroups.com
Hello,

I haven't discover what is the proper method to ignore mapping from one collection to another when source collection has object and it has a field which value is wanted ignore mapping from one collection to another?
There are hundreds of samples how to map flat classes but I haven't found any documentation or sample situation above.

What I mean is mentioned below is "some kind of syntax".

CreateMap<CollectOne, CollectTwo>()
 .IfValue(CollectTwo.doCopy == true)
 .ForMember(CollectTwo.var1, ColletOne.var2)
 .ForMember(CollectTwo.var5, ColletOne.var6)
 .ForMember(CollectTwo.var7, ColletOne.var10));


Thanks,




Jimmy Bogard

no leída,
18 may 2015, 12:35:26 p.m.18/5/15
para automapper-users
Suppose you didn't have AutoMapper - what would your code look like to map these two objects manually?

--
You received this message because you are subscribed to the Google Groups "AutoMapper-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to automapper-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

laan...@gmail.com

no leída,
18 may 2015, 1:25:39 p.m.18/5/15
para automapp...@googlegroups.com
Of course I have AutoMapper installed.
I have done many flat Class mappings before.

But *what is the AutoMapper's* way of doing mapping in situation I mentioned first??

I try to avoid programming mappings manually because I have AutoMapper in my Application Solution.
It should have this kind of feature inside it.

Jimmy Bogard

no leída,
18 may 2015, 2:34:19 p.m.18/5/15
para automapper-users
The way I developed AutoMapper is that I took code that I was already writing and built a tool to do that automatically. If I don't know what code you're writing today, I can't put that feature into AutoMapper. That's why I ask - I don't know what code you're trying to replace with AutoMapper.
Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos