berjmapper 1.0.2.1

dotnet add package berjmapper --version 1.0.2.1                
NuGet\Install-Package berjmapper -Version 1.0.2.1                
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="berjmapper" Version="1.0.2.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add berjmapper --version 1.0.2.1                
#r "nuget: berjmapper, 1.0.2.1"                
#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 berjmapper as a Cake Addin
#addin nuget:?package=berjmapper&version=1.0.2.1

// Install berjmapper as a Cake Tool
#tool nuget:?package=berjmapper&version=1.0.2.1                

Feature

The BerjMapper class provides a user-friendly interface to manage conversions between two different data types and helps to avoid duplicate work in the code.

Errors are corrected as a result of feedback.

berjmapper

Version

.net 7.0

Install


  dotnet add package  dotnet add package berjmapper --version 1.0.2.1

Information

var product = new Product
{
    Id = 1,
    Name = "berjCode",
    Description = "OpenSource"
};

var productDto = BerjMapper<Product, ProductDto>.Convert(product);
first parameter should be source, second should be destination. In Convert, it must be the converted type.
here product is converted to productdto.
  
# Use  Converting Product to ProductDto
var Product = new Product
{
    Id = 1,
    Name = "berjCode",
    Description = "OpenSource"
};


Console.WriteLine("----------- Converting Product to ProductDto ------------");

var productDto = BerjMapper<Product, ProductDto>.Convert(Product);


Console.WriteLine(productDto.Id);
Console.WriteLine(productDto.Name);


# Use  Converting ProductDto to Product

var testProductDto = new ProductDto
{
    Id = 1,
    Name = "berjCode",
};


var productTest = BerjMapper.Convert<ProductDto, Product>(testProductDto);

Console.WriteLine(productTest.Id);
Console.WriteLine(productTest.Name);

## Converting Product  To ProductListDto
   
Console.WriteLine("----------- ProductListDto ------------");
var products = new List<Product>()
{
    new Product { Id = 1, Name = "Product 1" },
    new Product { Id = 2, Name = "Product 2" },
    new Product { Id = 3, Name = "Product 3" },
};

var productListTest = BerjMapper<Product, ProductListDto>.ConvertList(products);

foreach (var productListDto in productListTest)
{
    Console.WriteLine(productListDto.Id);
    Console.WriteLine(productListDto.Name);
}
Console.WriteLine(productListDto.Name);

## Converting ProductListDto  To Product
   
var productListDtoObject = new List<ProductListDto>()
{
    new ProductListDto { Id = 1, Name = "Product-1 V2" },
    new ProductListDto { Id = 2, Name = "Product-2 V2" },
    new ProductListDto { Id = 3, Name = "Product-3 V2" },
};

var converProductListDtoToProduct = BerjMapper.ConvertList<ProductListDto, Product>(productListDtoObject);

foreach (var product in converProductListDtoToProduct)
{
    Console.WriteLine(product.Id);
    Console.WriteLine(product.Name);
}

....

##  Converting CreateProductDto To Product
   
Console.WriteLine("----------- CreateProductDto To Product  ------------");

var createProductDtoTest = BerjMapper<ProductCreateDto, Product>.Convert(productCreateDto);

Console.WriteLine("Product ID: " + createProductTest.Id);
Console.WriteLine("Product Name: " + createProductTest.Name);


## Warning
   *  No package is needed. Not recommended for large projects. Recommended for education and small projects.
   *   It can give errors in complex objects.
  

   
                                                                                                                     
   ###    By Abdullah Balikci - berjcode

      
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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.
  • net7.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
1.0.2.1 167 8/18/2023
1.0.2 141 8/18/2023
1.0.1 161 8/3/2023
1.0.0 166 5/4/2023

Added reverse transformation. Null errors fixed. The file structure has been corrected.