Late4dTrain.Domain.Abstractions
1.0.1
dotnet add package Late4dTrain.Domain.Abstractions --version 1.0.1
NuGet\Install-Package Late4dTrain.Domain.Abstractions -Version 1.0.1
<PackageReference Include="Late4dTrain.Domain.Abstractions" Version="1.0.1" />
paket add Late4dTrain.Domain.Abstractions --version 1.0.1
#r "nuget: Late4dTrain.Domain.Abstractions, 1.0.1"
// Install Late4dTrain.Domain.Abstractions as a Cake Addin
#addin nuget:?package=Late4dTrain.Domain.Abstractions&version=1.0.1
// Install Late4dTrain.Domain.Abstractions as a Cake Tool
#tool nuget:?package=Late4dTrain.Domain.Abstractions&version=1.0.1
Late4dTrain.Domain.Abstractions
Late4dTrain.Domain.Abstractions
This library provides a set of abstractions for Domain-Driven Design elements such as Entities, Value Objects, and Aggregate Roots. These abstractions serve as the building blocks for your domain model and enforce key characteristics required by each element.
Installation
Install the library using the following command:
dotnet add package Late4dTrain.Domain.Abstractions
Usage
Here is an example of how you can use the library:
public class Customer : AggregateRoot<Guid, DomainEvent>
{
public string Name { get; private set; }
public Customer(string name)
{
Id = Guid.NewGuid();
Name = name;
Events.Add(new CustomerCreated(Id));
}
}
public class CustomerCreated : DomainEvent
{
public Guid CustomerId { get; }
public CustomerCreated(Guid customerId)
{
CustomerId = customerId;
}
}
In this example, Customer
is an Aggregate Root that uses a Guid
as an identifier and DomainEvent
as its domain event type. When a new customer is created, a CustomerCreated
is added to the list of domain events.
Entity
Entities are fundamental building blocks of domain-driven design. They are mutable objects with a consistent thread of identity. Here is a basic example of how to create an entity:
public class SampleEntity : Entity<Guid>
{
public override Guid Id { get; protected set; } = Guid.NewGuid();
// Additional properties and methods here...
}
In this example, SampleEntity
is an entity with a unique identifier of type Guid
Value Object
Value objects are objects that we care about only because of their properties and the values those properties have. They don't have an identity, meaning two value objects with the same properties are considered equal. Here's an example:
public class SampleValueObject : IValueObject
{
// Properties and methods here...
}
In this example, SampleValueObject is a value object.
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
License
This project is licensed under the terms of the MIT license.
Product | Versions 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.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. |
-
.NETStandard 2.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.