David Walker

Announcing fFastMapper release 0.5

by David Walker

fFastMapper is ready and available via NuGet.

Use "Install-Package fFastMapper"

fFastMapper is a component to map property values between objects.

Usage:

Quick Start:

using Grax.fFastMapper;
...

var dest =  fFastMap.MapperFor<SourceType,DestinationType>(source);

or

var dest = new DestinationType();
fFastMap.Map(source,dest);

or

var dest = new DestinationType()
fFastMap.MapperFor<SourceType,DestinationType>(source, dest);

Global Configuration (affects maps not created yet):

using Grax.fFastMapper;

            fFastMap
                .GlobalSettings()
                .SetAutoInitialize(false)
                .SetDefaultMappingDirection(fFastMap.MappingDirection.LeftToRight);

Map Configuration (affects property mapping functions (ClearMappers, AddDefaultPropertyMappers, AddPropertyMapper, DeletePropertyMapper that run after this command)

            fFastMap
                .MapperFor<n1, n2>()
                .SetMappingDirection(fFastMap.MappingDirection.LeftToRight)

Mapping Functions

            fFastMap
                .MapperFor<n1, n2>()
                .ClearMappers()
                .AddDefaultPropertyMappers()
                .DeletePropertyMapper(left => left.Id)
                .AddPropertyMapper(left => left.Id, right => right.Id);

Debugging/Testing Functions

fFastMap.MapperFor<n1,n2>().Mappings() gives you a List of Tuples where the Item1 property is a string representation of the left (source) side of the mapping and the Item2 property is a string representation of the right (destination) side of the mapping.

fFastMap.MapperFor<n1,n2>().MappingsView() gives you a string describing all of the mappings for these types.

Tips

ClearMappers will remove all mappings.  It will not cause the Map command to fail, just no data will be mapped when that command runs.

Please note that any "MapperFor<n1,n2>" is equivalent to any other.  i.e.
var x = fFastMap.MapperFor<n1,n2>();
var z = fFastMap.MapperFor<n1,n2>();

x.ClearMappers();
y.Map(source,dest); // all Mappers were just cleared in previous line.  No data transferred.

David Walker

David Walker is a Software Consultant, Photographer, and Digital Artist based out of Orlando, Florida, USA.

He believes in secure reliable software and productive happy teams.

More ...