Entity-updater 2.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Entity-updater --version 2.0.0                
NuGet\Install-Package Entity-updater -Version 2.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="Entity-updater" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Entity-updater --version 2.0.0                
#r "nuget: Entity-updater, 2.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 Entity-updater as a Cake Addin
#addin nuget:?package=Entity-updater&version=2.0.0

// Install Entity-updater as a Cake Tool
#tool nuget:?package=Entity-updater&version=2.0.0                

Entity-updater

Update Entity from DTO using a simple mapper profile without using any reflection.

pipeline status

NuGet

This library is useful to update "Entities" (special objects that are generated from EntityFramework) from DTO (Data-Transfer-Object or objects that are coming from API layer) when Entity and DTO have the same type. This library will generate assignments given specified properties using LINQ expression trees:

entity.Id = dto.Id;

entity.Firstname = dto.Firstname;

entity.Lastname = dto.Lastname;

entity.DateOfBirth = dto.DateOfBirth;

entity.IsPressent = dto.IsPressent;

To use the library:

Person POCO:

public class Person
{
    public Guid Id { get; set; }

    public string Firstname { get; set; }

    public string Lastname { get; set; }

    public int Age { get; set; }

    public DateTime DateOfBirth { get; set; }

    public bool IsPressent { get; set; }
}

Mapper profile:

public class PersonProfile : EntityProfile<Person>
{
    public PersonProfile()
    {
        Map(x => x.Id)
            .Then(x => x.Age)
            .Then(x => x.Firstname)
            .Then(x => x.Lastname)
            .Then(x => x.IsPressent)
            .Then(x => x.DateOfBirth);
    }
}

Build the utility:

var utility = EntityMapper.Build(_ => {
    _.Assembly(Assembly.GetExecutingAssembly());
});

Person entity = ...;
Person dto = ...;

utility.Update(entity, dto);
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  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. 
.NET Core netcoreapp2.1 is compatible.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 2.1

    • 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.0.1 667 8/19/2019
2.0.0 540 8/19/2019
1.0.6 560 8/19/2019
1.0.5 532 8/19/2019
1.0.3 548 8/4/2019
1.0.2 548 8/3/2019
1.0.1 569 8/3/2019
1.0.0 564 8/3/2019

Working state.