Skip to content

Latest commit

 

History

History
39 lines (24 loc) · 1.98 KB

README.md

File metadata and controls

39 lines (24 loc) · 1.98 KB

Narochno.AsyncMapper

This is a library that sits on top of AutoMapper and aims to basically provide TypeConverters which are async.

AutoMapper still does the generic work of mapping from objects. However, to fill in extra data, sometimes you need an async source.

Why async?

Problem domain:

  • Aggregate domain objects that are built from different sources of data.
  • The biggest source of non-database data is a cache, which could be all async!
  • Fitting a domain on top of an aging database schema is hard. So lots of code may be required to adapt this schema to a domain. Other async sources may be required.

Fitting the glue of building/mapping a domain object from data into a AutoMapper mapping just makes sense.

How does it work?

  • Use IAsyncMapper instead of IMapper in your code.
  • Implement IAsyncMapping for your desired mappers.
  • AsyncMapper will fallback to IMapper when an instance of IAsyncMapping for the requested map isn't found.

Collection Handling

  • IAsyncMapper will do a loop for collections like IMapper will do.
  • Implement IAsyncCollectionMapping for optimized handling of IEnumerable mappings for batching async operations.

Components in a Toy Sample

Future work

  • Optimize/cache reflection operations.
  • Support more than netstandard1.6 ?
  • Support using Dependency Injection other than through IServiceProvider ?