Skip to content

No longer supported | Simple hight performance object mapper based on emitting CIL code.

License

Notifications You must be signed in to change notification settings

mchechulnikov/photosphere-mapping

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Photosphere.Mapping

Simple high performance flat object mapper based on emitting CIL code.
It perform mapping by properties names and assignable types.

Status

Windows build Status NuGet license

Install via NuGet

PM> Install-Package Photosphere.Mapping

Interface

This tiny library gives next extension methods

void MapTo<TSource, TTarget>(this TTarget target, TSource source);    // Map from existent object to another one
void MapToObject(this object target, object source);                  // Map from existent object to another one
TTarget Map<TSource, TTarget>(this TSource source);                   // Map from existent object to new object
TTarget MapObject<TTarget>(this object source);                       // Map from existent object to new object

Examples

Map object source to existent object target

source.MapTo(target);

Map object source of type Foo to new object target of type Bar

var target = source.Map<Foo, Bar>();

You can perform mapping from anonymous type

var source = new { A = "a", B = 1 };
source.MapToObject(target);

or

var source = new { A = "a", B = 1 };
var target = source.MapObject<Bar>();

but not vice versa (to anonymous type object), because anonymous type objects are immutable by design.

Perfomance

You can see perfomance test and pefromance test result.

About

No longer supported | Simple hight performance object mapper based on emitting CIL code.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages