YGMapper 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package YGMapper --version 1.0.0                
NuGet\Install-Package YGMapper -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="YGMapper" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add YGMapper --version 1.0.0                
#r "nuget: YGMapper, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install YGMapper as a Cake Addin
#addin nuget:?package=YGMapper&version=1.0.0

// Install YGMapper as a Cake Tool
#tool nuget:?package=YGMapper&version=1.0.0                

YGMapper

A simple mapper that maps one DTO to another DTO where the DTO types may or may not be identical

Installation

Include this package in the project file

Usage

for mapping all matching fields:

MapObjects mo1 = new MapObjects();
var result = mo1.Map<Entity2>(entity1);

or for mapping with included fields only (this will only include "Name", "EmailAddress" fields):

MapObjects mo2 = new MapObjects(new string[] { "Name", "EmailAddress" }, null);
var result2 = mo2.Map<Entity2>(entity1);

or for mapping with excluded fields (this will exclude "EmailAddress" field):

MapObjects mo3 = new MapObjects(null, new string[] { "EmailAddress" });
var result3 = mo3.Map<Entity2>(entity1);

Examples

Test project is provided in the solution to illustrate how to map a DTO, with included or excluded field names.

Output:

The output is Tuple<bool,string,T> , where Item1 represents whether or not the function has executed successfully, Item2 states the success or error message, and Item3 is the output DTO where the source object is mapped to.

Dependencies

none

Contributing

Any new ideas on how to enhance this class without adding much complexity, please adhere to SOLID principle

License

This project is licensed under the MIT License(LICENSE).

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.1.0 101 5/31/2024
2.0.0 108 5/15/2024
1.0.0 112 5/15/2024

Initial release, simple mapping functionality to map one DTO to another, with filtering