Skip to content
This repository was archived by the owner on Jun 25, 2026. It is now read-only.
inspired-codesPublic archive

About

Copies Values between Class instances, either by matching same Property Name or by matching properties and fields from Inetrface

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

17 Commits

Folders and files

Repository files navigation

Express Mapper

Copies values between two type instances that shares the same Copies values between between two object instances that do share the same interface. And, if there is no common interface, it copies values between source and target have for same properties - property name and type must be equal.

It is using reflection. To improve performance, type properties properties are cached after first round. The property info info is read from cache and to not call reflection a second time for same property or field.

Example 1:

public class Foo : IModel { ... }

public class Baar : IModel { ... }

InterfacePropertiesClone.CopyValues<Foo, Baar, IModel>(source, target);

Example 2:

public class Foo { ... }

public class Baar : IModel { ... }

InterfacePropertiesClone.CopyValues<Foo, Baar, IModel>(source, target);

The target instance gets populated with same values for all properties from IModel.
Reference Type properties and Value Type properties are supported by boxing.

Limitations

  • In opposite to other mappers like AutoMapper, it's not configurable.
  • not tested with record types

Build and Test

Run all test methods. Test methods covers almost 100% of the possible cases

Contribute

Create your branch dev/, enhance the code in your branch and create a pull request.

The pull request and approval chain is:

  • individual branch ==> qa (pre-release nuget) ==> master (release nuget)

About

Copies Values between Class instances, either by matching same Property Name or by matching properties and fields from Inetrface

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages