Pangea.Domain 0.5.0

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

// Install Pangea.Domain as a Cake Tool
#tool nuget:?package=Pangea.Domain&version=0.5.0

Pangea.Domain

A project containing multiple different value objects with behaviour to have a rich domain model and have logic about these value objects in one place. Examples are CreditCard, Percentage, Iban, etc. When using this library the domain entities should have these rich value objects as properties. E.g.

public class Customer
{
	public Percentage Discount { get; set; }
	public DateRange DiscountPeriod { get; set; }
	public GpsLocation Location { get; set; }
	public Currency Currency { get; set; }
	public Iban BankAccount { get; set; }
}

The example above makes it much easier to work with the domain entities and encapsulates much more information than standard .Net types.

Commonalities between value types

All value types are [Serializable] and implement IXmlSerializable.

TryParse

All the types for which it makes sense have a TryParse method that works similar to the default .Net implementations

Unsafe

Some types have quite some validation to make sure the given constructor argument is a valid value for the value type. For performance reasons it might be useful to bypass these validations when it is already known that the validations will pass. For instance a credit card from the database might already be validated to be correct, so redoing this validation every time the data is loaded from the database results in unnecessary overhead. Note that it might be better to only use this when the performance is indeed negatively impacted.

Deconstruct

When applicable it is easy for a type to be deconstructed into its parts in C# 7.0. E.g.

var (lat, lon) = new GpsLocation(5.454,7.244).Deconstruct();
var (start, end) = DateRange.Today().Deconstruct();

Note

The repository is not following the Single Responsibility Principle for the whole repository, since the value objects are a grab bag of all different unrelated concepts. I am aware of that, but still I hope there is someone who is helped by this. I can imagine that in certain cases a developer is tempted to only use a single concept / value object that is applicable for his/her project. Feel free to copy the source code for one file, although that will therefore (obviously) will not be updated with new versions.

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.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

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
0.5.0 1,099 12/18/2018