Ministry.Compositions 2.0.0

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

// Install Ministry.Compositions as a Cake Tool
#tool nuget:?package=Ministry.Compositions&version=2.0.0                

Introduction

This project provides a suite of extension methods that enable fluent, functional style coding when manipulating objects.

Methods

Collection Compositions

ICollection.AddItem()

Adds the given new object to a collection and returns the collection. To be used as a preferred form to traditional collection Add when chaining is necessary or when updating an EF object tree.

FOR EF: Usage of this method ensures object trees are populated in the correct order for persistence of IDs.

ICollection.AddItems()

Adds the given new collection to a collection and returns the collection. To be used as a preferred form to traditional collection Add when chaining is necessary or when updating an EF object tree.

FOR EF: Usage of this method ensures object trees are populated in the correct order for persistence of IDs.

ICollection.AddItemsIf()

Adds the given new collection, evaluating each item against a given predicate, to a collection and returns the collection. Allows adding collections conditionally, for example, removing duplicates.

object.AddItemsToIf() / object.AddItemsToIfAsync()

Adds the given new collection, evaluating each item against a given predicate, to the specified collection property and returns the parent object. Allows adding collections conditionally, for example, removing duplicates.

object.AddAndReturnItem()

Adds the given new object to a collection and returns the object that was added. To be used as a preferred form to traditional collection Add when chaining is necessary or when updating an EF object tree.

FOR EF: Usage of this method ensures object trees are populated in the correct order for persistence of IDs.

ICollection.RemoveItem()

Removes the given new object from a collection and returns the collection. To be used as a preferred form to traditional collection Add when chaining is necessary or when updating an EF object tree.

FOR EF: Usage of this method ensures object trees are populated in the correct order for persistence of IDs.

ICollection.RemoveItemIf()

Evaluates each item in a collection against a given predicate, removes the offending items, then returns the collection. Allows removing items from collections conditionally, for example, removing duplicates.

Object Compositions

object.Compose() / object.ComposeAsync()

Enables functional composition of a method, enabling chaining. Currently methods with up to 3 parameters are supported. Feel free to form an update to add more parameters - these updates would be most welcome.

object.SetProperty() / object.SetPropertyAsync()

Sets the specified navigation property value on an object to enable chaining and to ensure that the object tree is built in the right order, returning the object.

object.SetAndReturnProperty() / object.SetAndReturnPropertyAsync()

Sets the specified navigation property value on an object to enable chaining and to ensure that the object tree is built in the right order, returning the object property value.

Collection Mutations

These are void return methods.

ICollection.AddRange()

Adds the provided collection to the existing collection.

ICollection.ForEach()

A fluent version of the for each loop. Do NOT use with async calls.

ICollection.ForEachAsync()

A fluent version of the for each loop for async calls.

Projections

object.Project(object)

Projects all property values from the input object on the passed in target object, if they are present in both. This is a really simple way of mapping matching data between types. If choosing to persist existing values please note that, due to it's binary nature, boolean values will not persist and must be re-set. Returns the output object.

object.Project(Func)

Uses the provided function to project one type into another type. Returns the output object.

object.Project(Func, Accumulator)

Uses the provided function to project one type into another type and increments an accumulator. Returns the output object.

IList.Partition()

Partitions the specified list into blocks of the provided size.

IEnumerable.Select()

Various additional overloads for Select. Maps the specified predicate to project each instance of one type in the collection into another type using an accumulator to build value increments for the mapping.

IEnumerable.Flatten()

Flattens a collection of collections down to a single collection.

IEnumerable.Sorted

Sorts the specified collection according to the comparison provided.

The Ministry of Technology Open Source Products

Welcome to The Ministry of Technology open source products. All open source Ministry of Technology products are distributed under the MIT License for maximum re-usability. Our other open source repositories can be found here...

Where can I get it?

You can download the package for this project from any of the following package managers...

Contribution guidelines

If you would like to contribute to the project, please contact me.

Who do I talk to?

  • Keith Jackson - temporal-net@live.co.uk
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 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 is compatible.  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 netcoreapp1.0 was computed.  netcoreapp1.1 was computed.  netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard1.6 is compatible.  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 is compatible.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen30 was computed.  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 (4)

Showing the top 4 NuGet packages that depend on Ministry.Compositions:

Package Downloads
Umbraco.Pylon

Core classes to aid with more code orientated Umbraco implementations.

UmbracoPylon.Autofac

Core classes to aid with more code orientated Umbraco implementations.

UmbracoPylon

Core classes to aid with more code orientated Umbraco implementations.

Ministry.Csv

CSV Component Package

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0 3,742 12/29/2023
1.3.0 8,827 5/17/2021
1.2.1 1,249 11/2/2018
1.0.1 6,365 5/9/2018
1.0.0 1,064 3/21/2018