Tuesday, April 27, 2010

Configurating the AutoMapper

Have you ever configured the AutoMapper for your Application?

I really impressed with AutoMapper's Jimmy Bogard. If you aren't try it before, I advice you should try it now. It's so good for mapping objects (maybe entity to DTO). I still remembered I take many time for writing mapping objects in past. But now with AutoMapper all thing is simple. Now I'm trying to collecting all best practices that I learned from co-worker and Internet, trying to implementing the project (it's not publish yet). And when implemented the AutoMapper for my Application, I also get some problems from it. So finally, I also finished my work. Now I will show it for you.

In this post, I used Bootstrapper for booting my Application. I attend to writing a post about it later (comming soon :D). So I need when my Application run, I will have any thing I need. So I will implement IBootstrapperTask for it. Next, I used the StructureMap for scanning all assemblies implement
IBootstrapperTask interface.

And there are some code as below:

+ Registry class (implement Registry class from Structure Map)

+ Profile class

+ AutoMapperConfigurator class

As you see, it's seen very easy (^_^). I'm many thanks to some articles that I read in Internet. In specially, I really referenced to 2 articles as below:
Good bye and see you next post!

No comments:

Post a Comment