Automapper functionality

techie | May 11 - 2010

Automapper is a framework which uses a convention-based matching algorithm to match up source to destination values. Automapper uses a fluent configuration API to define an object-object mapping strategy.We are going to learn how to use type resolvers. Type resolvers  will allow you to perform custom value mapping in a very simple and elegant way with little coding. Type resolvers define types derived from a class or interface, including generic arguments. They can implement theory and data attributes for use with Automapper uses algorithm to match up source to destination values.

General purpose query interfaces to relational databases can expose vast amounts of content to the Semantic Web. Automapper, is a tool that automatically generates data source and mapping ontologies using OWL and SWRL. We also describe the use of these ontologies in our Semantic Distributed Query architecture, an implementation for mapping RDF queries to disparate data sources, including SQL-compliant databases, using SPARQL as the query language.

Auto mapper functionality is that one that  exploits some of the expressiveness of OWL to produce more accurate translations. A comparison with related work on Semantic Web access to relational

databases is also provided as well as an investigation into the use of OWL 1.1.Auto mapper is geared towards model projection scenarios to flatten complex object models to DTOs and other simple objects, whose design is better suited for serialization, communication, messaging, or creation of an anti-corruption layer between the domain and application layer.

As we  have only supplied the type of the custom resolver to Automapper, the mapping engine will use reflection to create an instance of the value resolver.If we don’t want Auto mapper to use reflection to create the instance, we can either supply the instance directly, or use the constructed by method to supply a custom constructor method.

Although Automapper covers quite a few destination member mapping scenarios, there are the 1 to 5% of destination values that need a little help in resolving. Many times, this custom value resolution logic is domain logic that can go straight on our domain. However, if this logic pertains only to the mapping operation, it would clutter our source types with unnecessary behavior. In such instances, Automapper allows for configuring custom value resolvers for destination members.