Upload
oleksii-duhno
View
407
Download
0
Embed Size (px)
Citation preview
Object-to-
object
mapping
© Oleksii Dukhno @ Lohika Systems
Complexity of software
Tools for fighting with the
complexity
Abstractions and model
Models, DTO and ViewModels data transfer object = model data only
view model = model data + behavioral aspects
data transfer object != view modelbut
view model = data transfer object
Models, DTO and ViewModels
Flattening
Why using o-2-o ?
Encapsulate Flattening Logic
Why using AutoMapper ?
Encapsulate Flattening Logic
Result = Neater code,
Simpler support,
Better understanding
How to use AutoMapper ?
Mapping Through
Convention
Source/Destination Properties Names
Convention
Mapping Through
Configuration
Projection
Value Resolver
Type Converter
Ignore
TestMapping
Validate Configuration
Mapping Through Convention
Mapping Through ConfigurationIgnore
Will throw AutomapperConfigurationException
Mapping Through ConfigurationIgnore
Mapping Through ConfigurationProjection
Mapping Through ConfigurationProjection
Mapping Through ConfigurationType Converter
Mapping Through ConfigurationType Converter
Mapping Through ConfigurationValue Resolver
Mapping Through ConfigurationValue Resolver
Mapping Through ConfigurationValue Resolver
Using AutoMapper in Allocine-CMS
Using AutoMapper in Allocine-CMS
Emit Mapper Key Sufficiencies
Really fast (close to hand written code)
Supports mono
Emit Mapper - simplest example
CODE
Emit Mapper – custom converter
CODE
Emit Mapper – post processing
CODE
Emit Mapper vs. AutoMapper
Style Facade Speed Open Source Reliability
Emit Mapper Functional No The Best Yes Low
AutoMapper OO Yes Good Yes High