EntityChange 5.1.0

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

// Install EntityChange as a Cake Tool
#tool nuget:?package=EntityChange&version=5.1.0                

EntityChange

Library to compare two entity object graphs detecting changes

Build Project

NuGet Version

Download

The EntityChange library is available on nuget.org via package name EntityChange.

To install EntityChange, run the following command in the Package Manager Console

PM> Install-Package EntityChange

More information about NuGet package available at https://nuget.org/packages/EntityChange

Features

  • Compare complete entity graph including child entities, collections and dictionaries
  • Collection compare by index or element equality
  • Dictionary compare by key
  • Custom value string formatter
  • Custom entity equality compare
  • Markdown or Html change report formatter

Configuration

Configure the Contact properties and collections.

EntityChange.Configuration.Default.Configure(config => config
    .Entity<Contact>(e =>
    {
        // set the FirstName display name
        e.Property(p => p.FirstName).Display("First Name");
        // compare the Roles collection by string equality
        e.Collection(p => p.Roles)
            .CollectionComparison(CollectionComparison.ObjectEquality)
            .ElementEquality(StringEquality.OrdinalIgnoreCase);
        // set how to format the EmailAddress entity as a string
        e.Collection(p => p.EmailAddresses).ElementFormatter(v =>
        {
            var address = v as EmailAddress;
            return address?.Address;
        });
    })
    .Entity<EmailAddress>(e =>
    {
        e.Property(p => p.Address).Display("Email Address");
    })
);

Comparison

Compare to Contact entities

// create comparer using default configuration
var comparer = new EntityComparer();

// compare original and current instances generating change list 
var changes = comparer.Compare(original, current).ToList();

Change Report

Sample output from the MarkdownFormatter

OUTPUT

  • Removed Administrator from Roles
  • Changed Email Address from user@Personal.com to user@gmail.com
  • Added user@home.com to Email Addresses
  • Changed Status from New to Verified
  • Changed Updated from 5/17/2016 8:51:59 PM to 5/17/2016 8:52:00 PM
  • Changed Zip from 10026 to 10027
  • Changed Number from 888-555-1212 to 800-555-1212
  • Added Blah to Categories
  • Changed Data from 1 to 2
  • Changed Data from ./home to ./path
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  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 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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on EntityChange:

Package Downloads
KickStart.EntityChange

KickStart Extension for EntityChange library

MediatR.CommandQuery.Audit

CQRS framework based on MediatR

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
5.3.1 4,284 5/1/2024
5.3.0 176 4/25/2024
5.2.0 867 3/25/2024
5.1.0 4,811 7/28/2023
5.0.21 2,166 12/28/2022
5.0.18 22,131 11/9/2022
5.0.14 375 11/7/2022
5.0.12 354 11/5/2022
4.1.0.104 9,161 3/31/2021
4.1.0.98 439 2/15/2021
4.1.0.97 392 2/15/2021
4.1.0.71 19,041 4/26/2020
4.0.0.66 1,547 4/11/2020
3.0.0.30 22,126 6/6/2019
3.0.0.29 3,464 11/5/2018
3.0.0.19 6,507 8/22/2017
2.1.0.16 12,802 3/6/2017
2.1.0.15 1,055 3/4/2017
2.0.0.11 2,014 7/14/2016
1.0.0.8 1,637 5/18/2016
1.0.0.7 1,090 5/18/2016
1.0.0.6 1,090 5/18/2016
1.0.0.5 1,079 5/16/2016
1.0.0.3 1,097 5/16/2016