VOOZH about

URL: https://www.nuget.org/packages/Fluxera.Entity/8.0.4

⇱ NuGet Gallery | Fluxera.Entity 8.0.4




👁 Image
Fluxera.Entity 8.0.4

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Fluxera.Entity --version 8.0.4
 
 
NuGet\Install-Package Fluxera.Entity -Version 8.0.4
 
 
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="Fluxera.Entity" Version="8.0.4" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Fluxera.Entity" Version="8.0.4" />
 
Directory.Packages.props
<PackageReference Include="Fluxera.Entity" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Fluxera.Entity --version 8.0.4
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Fluxera.Entity, 8.0.4"
 
 
#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.
#:package Fluxera.Entity@8.0.4
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Fluxera.Entity&version=8.0.4
 
Install as a Cake Addin
#tool nuget:?package=Fluxera.Entity&version=8.0.4
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

👁 Build Status

Fluxera.Entity

An aggregate root and entity objects library.

This library helps in implementing Entity, Aggregate Root and Domain Events. The base class for entities implement Equality and Uniqueness based on selected attributes of the entity instead of the references.

Equality and Uniqueness

The equality check consist of two major steps:

1.) When comparing two entities for Equality at first we check if the entites are both not transient and their IDs are equal. In this case the entites are considered equal, even if their values are different.

2.) If the first step did not signal Equality we check if the entities are both transient and their domain signature attributes are equal. You define which attributes of the entity make up their domain signature by adding the [DomainSignature] attribute to the corresponding properties. The attributes are then picked up by the default implementation using reflection. If you do not want to use the default implementation you can override the GetEqualityComponents() method an return the values to use manually.

Domain Events

This library provides the infrastructure to implement, register and dispatch domain events from entities to loosely-coupled domain event handlers. You can add events to the DomainEvents collection of an entity and implement two different types of domain event handlers for it.

This library provides the nessessary dispatcher service which can be used to integrate the event dispatching in a Repository implementation.

IDomainEventHandler

A domain event handler of this type will be executed before a Repository adds or updates the entity in the storage.

ICommittedDomainEventHandler

A domain event handler of this type will be executed after a Repository adds or updates the entity in the storage.

Usage

public class Employee : AggregateRoot<Employee>
{
	[DomainSignature]
	public string Name { get; set; }

	[DomainSignature]
	public int EmployeeNumber { get; set; }

	public decimal Salary { get; set; }

	public void GiveRaise(decimal raiseAmount)
	{
		Guard.Against.NegativeOrZero(raiseAmount, nameof(raiseAmount));

		this.Salary += raiseAmount;

		this.DomainEvents.Add(new SalaryRaisedEvent(this.Salary));
	}
}
public class SalaryRaisedEvent : IDomainEvent
{
	public SalaryRaisedEvent(decimal newSalary)
	{
		this.NewSalary = newSalary;
		this.HandlerNames = new List<string>();
	}

	public decimal NewSalary { get; }
}
public class SalaryRaisedEventHandler : IDomainEventHandler<SalaryRaisedEvent>
{
	public Task HandleAsync(SalaryRaisedEvent domainEvent)
	{
		// Do something ...
		return Task.CompletedTask;
	}
}
public class SalaryRaisedEventHandler : ICommittedDomainEventHandler<SalaryRaisedEvent>
{
	public Task HandleAsync(SalaryRaisedEvent domainEvent)
	{
		// Do something ...
		return Task.CompletedTask;
	}
}
// A domain event support.
services.AddDomainEvents(builder =>
{
	builder
		.AddDomainEventHandlers<SalaryRaisedEventHandler>()
		.AddDomainEventHandlers<AdditionalSalaryRaisedEventHandler>()
		.AddDomainEventHandlers<SalaryRaisedCommittedEventHandler>();
});

IDomainEventDispatcher dispatcher = /* Get the dispatcher ... */;

SalaryRaisedEvent salaryRaisedEvent = new SalaryRaisedEvent(100_000);

await dispatcher.DispatchAsync(salaryRaisedEvent);
await dispatcher.DispatchCommittedAsync(salaryRaisedEvent);

References

Jimmy Bogard - A better domain events pattern

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

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Fluxera.Entity:

Package Downloads
Fluxera.Repository.Abstractions

The abstractions for the generic repository implementation.

Fluxera.Repository

A generic repository implementation.

Fluxera.Extensions.Hosting.Modules.Domain

A module that enables the domain.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.0.1 233 4/21/2026
10.0.0 241 4/12/2026
9.2.0 382 7/28/2025
9.1.0 620 2/5/2025
9.0.1 637 11/16/2024
9.0.0 398 11/14/2024
8.3.4 854 11/1/2024
8.3.3 300 7/9/2024
8.3.2 1,767 6/12/2024
8.3.1 459 6/8/2024
8.3.0 1,285 5/26/2024
8.2.1 320 5/24/2024
8.2.0 944 4/28/2024
8.1.2 1,909 4/25/2024
8.1.1 299 4/25/2024
8.1.0 298 4/25/2024
8.0.7 2,757 4/18/2024
8.0.6 1,302 4/13/2024
8.0.5 519 4/13/2024
8.0.4 866 3/19/2024
Loading failed