initializing automapper

12 views
Skip to first unread message

Alex

unread,
Jan 19, 2012, 3:46:38 PM1/19/12
to TelerikMvcGridCustomBindingHelper
I have very simple classes to be mapped, but I can't get AutoMapper to
work. I keep getting the "AutoMapper can't find mappings for class"
exception. I registered the mappings like so:

GridModelMapper.CreateMap<OrderViewModel, Order>();
GridModelMapper.CreateMap<Order, OrderViewModel>();

but this didn't help. Any suggestions?

Luis Fernando

unread,
Jan 19, 2012, 4:25:23 PM1/19/12
to telerikmvcgridcu...@googlegroups.com
Anh, well, maybe I should add a new feature for this to work...

Currently you have to create two mappings, GridModelMapper and AutoMapper, but ONLY if AutoMapper is not enough.

Simple maps should be made ONLY by AutoMapper. What is considered a simple mapping? Anything that does not involve CustomValueResolver, CustomTypeConverter, or something like that... (do you get it?)

One more thing, when using the GridModelMapper remember to map the properties of the objects, not only the types as you have done (a bug? Not!!! The purpose of the GMM is exactly that.).




2012/1/19 Alex <alexf...@gmail.com>



--

Att,

Luis Fernando

Luis Fernando

unread,
Jan 19, 2012, 4:34:59 PM1/19/12
to telerikmvcgridcu...@googlegroups.com
You are Brazilian?

--
Luis Fernando

Alex

unread,
Jan 19, 2012, 4:45:00 PM1/19/12
to TelerikMvcGridCustomBindingHelper
Thank you very much.

I changed my code to:

AutoMapper.Mapper.CreateMap<OrderViewModel, Order>();
AutoMapper.Mapper.CreateMap<Order, OrderViewModel>();

and the error went away. I am now getting any results showing in the
grid, so I have to figure that out next.

Alex

On Jan 19, 4:25 pm, Luis Fernando <luisfernand...@live.com> wrote:
> Anh, well, maybe I should add a new feature for this to work...
>
> Currently you have to create two mappings, GridModelMapper and AutoMapper,
> but ONLY if AutoMapper is not enough.
>
> Simple maps should be made ONLY by AutoMapper. What is considered a simple
> mapping? Anything that does not involve CustomValueResolver,
> CustomTypeConverter, or something like that... (do you get it?)
>
> One more thing, when using the GridModelMapper remember to map the
> properties of the objects, not only the types as you have done (a bug?
> Not!!! The purpose of the GMM is exactly that.).
>
> See the second example in the instructions page:https://bitbucket.org/Lunadie/telerikmvcgridcustombindinghelper/wiki/...
>
> 2012/1/19 Alex <alexfeld...@gmail.com>
Message has been deleted

Luis Fernando

unread,
Jan 19, 2012, 4:52:11 PM1/19/12
to telerikmvcgridcu...@googlegroups.com
Umm, what a shame. I thought I could get a partner to help me improve this helper. Just kidding!

Alex, your last email seems to be incomplete.

347.gif

Alex Feldman

unread,
Jan 19, 2012, 4:54:21 PM1/19/12
to telerikmvcgridcu...@googlegroups.com
If I use your helper in my project I will gladly provide input for your helper.

Why is my last email incomplete?
347.gif
Reply all
Reply to author
Forward
0 new messages