Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .nuget/Cuemon.Core/PackageReleaseNotes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,21 @@ Availability: .NET 9, .NET 8 and .NET Standard 2.0
- REMOVED UnitPrefix enum from the Cuemon namespace
- REMOVED UnitPrefixFormatter class from the Cuemon namespace
- REMOVED ZeroPrefix class from the Cuemon namespace
- REMOVED DataPairCollection class from the Cuemon.Collections namespace
- REMOVED DataPairDictionary class from the Cuemon.Collections namespace
- REMOVED Initializer class from the Cuemon namespace
- REMOVED InitializerBuilder class from the Cuemon namespace
- REMOVED Mapping class from the Cuemon namespace
- REMOVED IndexMapping class from the Cuemon namespace
- REMOVED HorizontalDirection enum from the Cuemon namespace
- REMOVED VerticalDirection enum from the Cuemon namespace (moved to the Cuemon.Extensions namespace in the Cuemon.Extensions.Core assembly)
- REMOVED IWrapper interface from the Cuemon namespace (moved to the Cuemon.Extensions namespace in the Cuemon.Extensions.Core assembly)
- REMOVED Wrapper class from the Cuemon namespace (moved to the Cuemon.Extensions namespace in the Cuemon.Extensions.Core assembly)
- REMOVED HierarchyDecoratorExtensions class from the Cuemon namespace (moved to the Cuemon.Extensions.Runtime namespace in the Cuemon.Extensions.Core assembly)
- REMOVED Hierarchy class from the Cuemon namespace (moved to the Cuemon.Extensions.Runtime namespace in the Cuemon.Extensions.Core assembly)
- REMOVED IHierarchy interface from the Cuemon namespace (moved to the Cuemon.Extensions.Runtime namespace in the Cuemon.Extensions.Core assembly)
- REMOVED ObjectHierarchyOptions class from the Cuemon.Reflection namespace (moved to the Cuemon.Extensions.Runtime namespace in the Cuemon.Extensions.Core assembly and renamed to HierarchyOptions)
- REMOVED HierarchySerializer class from the Cuemon.Runtime.Serialization namespace (moved to the Cuemon.Extensions.Runtime.Serialization namespace in the Cuemon.Extensions.Core assembly)

# New Features
- ADDED Failure record in the Cuemon.Diagnostics namespace that represents a failure model with detailed information about an exception
Expand Down
9 changes: 9 additions & 0 deletions .nuget/Cuemon.Extensions.Core/PackageReleaseNotes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,22 @@ Availability: .NET 9, .NET 8 and .NET Standard 2.0
- REMOVED ConditionExtensions class from the Cuemon.Extensions namespace and moved members to Condition class in the Cuemon.Core assembly (Cuemon namespace)
- REMOVED ValidatorExtensions class from the Cuemon.Extensions namespace and moved members to Validator class in the Cuemon.Core assembly (Cuemon namespace)
- REMOVED ReplaceLineEndings extension method from the StringExtensions class in the Cuemon.Extensions namespace
- REMOVED MappingExtensions class from the Cuemon.Extensions namespace

# New Features
- ADDED ActionFactory class in the Cuemon.Extensions namespace that provides access to factory methods for creating ActionFactory{TTuple} objects that encapsulate a delegate with a variable amount of generic arguments
- ADDED FuncFactory class in the Cuemon.Extensions namespace that provides access to factory methods for creating FuncFactory{TTuple, TResult} objects that encapsulate a function delegate with a variable amount of generic arguments
- ADDED MutableTupleFactory class in the Cuemon.Extensions namespace that provides access to factory methods for creating MutableTuple objects
- ADDED TesterFuncFactory class in the Cuemon.Extensions namespace that provides access to factory methods for creating TesterFuncFactory{TTuple, TResult, TSuccess} objects that encapsulate a tester function delegate with a variable amount of generic arguments
- ADDED AsyncDisposable class in the Cuemon.Extensions namespace that provides a mechanism for asynchronously releasing both managed and unmanaged resources with focus on the former
- ADDED VerticalDirection enum in the Cuemon.Extensions namespace that specifies a set of values defining a vertical direction
- ADDED IWrapper interface in the Cuemon.Extensions namespace that defines a generic way to wrap an object instance inside another object
- ADDED Wrapper class in the Cuemon.Extensions namespace that provides a way to wrap an object instance inside another object
- ADDED Hierarchy class in the Cuemon.Extensions.Runtime namespace that represents a way to expose a node of a hierarchical structure, including the node object type
- ADDED HierarchyDecoratorExtensions class in the Cuemon.Extensions.Runtime namespace that provides (hidden) extensions to the IHierarchy interface
- ADDED HierarchyOptions class in the Cuemon.Extensions.Runtime namespace that represents a set of options to configure the behavior of the Hierarchy and HierarchySerializer class
- ADDED IHierarchy interface in the Cuemon.Extensions.Runtime namespace that defines a way to expose a node of a hierarchical structure
- ADDED HierarchySerializer class in the Cuemon.Extensions.Runtime.Serialization namespace that provides a way to serialize objects to nodes of IHierarchy

Version 8.3.2
Availability: .NET 8, .NET 6 and .NET Standard 2.0
Expand Down
30 changes: 29 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),

For more details, please refer to `PackageReleaseNotes.txt` on a per assembly basis in the `.nuget` folder.

## [9.0.0] - TBD (sometime in November 2024)
## [9.0.0] - 2024-11-13

> [!IMPORTANT]
> The following projects has been removed with this release and migrated to [Codebelt](https://github.com/codebeltnet):
Expand All @@ -21,6 +21,8 @@ For more details, please refer to `PackageReleaseNotes.txt` on a per assembly ba

> [!NOTE]
> Types that are removed from this solution (but otherwise fits naturally together) will be migrated to smaller and more focused repositories in the [Codebelt](https://github.com/codebeltnet) organization, renamed to better reflect their purpose and published as standalone packages on NuGet.
>
> - [Codebelt.Unitify](https://github.com/codebeltnet/unitify) is an example of a repository that received types from this solution and is now a standalone library that provides a uniform way of working with prefixes and multiples in the context of units of measure.

This major release is first and foremost focused on ironing out any wrinkles that have been introduced with .NET 9 preview releases so the final release is production ready together with the official launch from Microsoft.

Expand All @@ -32,6 +34,9 @@ Highlighted features included in this release:

- Support for both **FaultDetails** (HttpExceptionDescriptor) and **ProblemDetails** in the context of ASP.NET (both vanilla and MVC)
- Reduced footprint in the core assemblies by removing obsolete and redundant code
- Went from approximately 700 KB to 500 KB in the core assembly
- Types reduced with approximately 20% which is about 100 types
- Central Package Management (CPM) for all projects in the solution

### Added

Expand All @@ -54,6 +59,14 @@ Highlighted features included in this release:
- MutableTupleFactory class in the Cuemon.Extensions namespace that provides access to factory methods for creating MutableTuple objects
- TesterFuncFactory class in the Cuemon.Extensions namespace that provides access to factory methods for creating TesterFuncFactory{TTuple, TResult, TSuccess} objects that encapsulate a tester function delegate with a variable amount of generic arguments
- AsyncDisposable class in the Cuemon.Extensions namespace that provides a mechanism for asynchronously releasing both managed and unmanaged resources with focus on the former
- VerticalDirection enum in the Cuemon.Extensions namespace that specifies a set of values defining a vertical direction
- IWrapper interface in the Cuemon.Extensions namespace that defines a generic way to wrap an object instance inside another object
- Wrapper class in the Cuemon.Extensions namespace that provides a way to wrap an object instance inside another object
- Hierarchy class in the Cuemon.Extensions.Runtime namespace that represents a way to expose a node of a hierarchical structure, including the node object type
- HierarchyDecoratorExtensions class in the Cuemon.Extensions.Runtime namespace that provides (hidden) extensions to the IHierarchy interface
- HierarchyOptions class in the Cuemon.Extensions.Runtime namespace that represents a set of options to configure the behavior of the Hierarchy and HierarchySerializer class
- IHierarchy interface in the Cuemon.Extensions.Runtime namespace that defines a way to expose a node of a hierarchical structure
- HierarchySerializer class in the Cuemon.Extensions.Runtime.Serialization namespace that provides a way to serialize objects to nodes of IHierarchy

### Changed

Expand Down Expand Up @@ -165,6 +178,21 @@ Highlighted features included in this release:
- UnitPrefix enum from the Cuemon namespace (breaking change)
- UnitPrefixFormatter class from the Cuemon namespace (breaking change)
- ZeroPrefix class from the Cuemon namespace (breaking change)
- DataPairCollection class from the Cuemon.Collections namespace
- DataPairDictionary class from the Cuemon.Collections namespace
- Initializer class from the Cuemon namespace
- InitializerBuilder class from the Cuemon namespace
- Mapping class from the Cuemon namespace
- IndexMapping class from the Cuemon namespace
- HorizontalDirection enum from the Cuemon namespace
- VerticalDirection enum from the Cuemon namespace (moved to the Cuemon.Extensions namespace in the Cuemon.Extensions.Core assembly)
- IWrapper interface from the Cuemon namespace (moved to the Cuemon.Extensions namespace in the Cuemon.Extensions.Core assembly)
- Wrapper class from the Cuemon namespace (moved to the Cuemon.Extensions namespace in the Cuemon.Extensions.Core assembly)
- HierarchyDecoratorExtensions class from the Cuemon namespace (moved to the Cuemon.Extensions.Runtime namespace in the Cuemon.Extensions.Core assembly)
- Hierarchy class from the Cuemon namespace (moved to the Cuemon.Extensions.Runtime namespace in the Cuemon.Extensions.Core assembly)
- IHierarchy interface from the Cuemon namespace (moved to the Cuemon.Extensions.Runtime namespace in the Cuemon.Extensions.Core assembly)
- ObjectHierarchyOptions class from the Cuemon.Reflection namespace (moved to the Cuemon.Extensions.Runtime namespace in the Cuemon.Extensions.Core assembly and renamed to HierarchyOptions)
- HierarchySerializer class from the Cuemon.Runtime.Serialization namespace (moved to the Cuemon.Extensions.Runtime.Serialization namespace in the Cuemon.Extensions.Core assembly)

## [8.3.2] - 2024-08-04

Expand Down
41 changes: 0 additions & 41 deletions src/Cuemon.Core/Collections/DataPairCollection.cs

This file was deleted.

41 changes: 0 additions & 41 deletions src/Cuemon.Core/Collections/DataPairDictionary.cs

This file was deleted.

4 changes: 2 additions & 2 deletions src/Cuemon.Core/Extensions/ExceptionDecoratorExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static IEnumerable<Exception> Flatten(this IDecorator<Exception> decorato
{
Validator.ThrowIfNull(decorator);
if (decorator.Inner is AggregateException ae) { return ae.Flatten().InnerExceptions; }
return Hierarchy.WhileSourceTraversalHasElements(decorator.Inner, FlattenCallback).Skip(1);
return Decorator.RawEnclose(decorator.Inner).TraverseWhileNotEmpty(FlattenCallback).Skip(1);
}

private static IEnumerable<Exception> FlattenCallback(Exception source)
Expand All @@ -37,4 +37,4 @@ private static IEnumerable<Exception> FlattenCallback(Exception source)
return source.InnerException == null ? Enumerable.Empty<Exception>() : Arguments.Yield(source.InnerException);
}
}
}
}
44 changes: 44 additions & 0 deletions src/Cuemon.Core/Extensions/ObjectDecoratorExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Reflection;
Expand Down Expand Up @@ -95,5 +96,48 @@ public static object ChangeType(this IDecorator<object> decorator, Type targetTy
}
}
}

/// <summary>
/// Resolves the default value of a property from the enclosed object of the specified <paramref name="decorator"/>.
/// </summary>
/// <param name="decorator">The <see cref="IDecorator{T}"/> to extend.</param>
/// <param name="pi">The <see cref="PropertyInfo"/> of the property to resolve the value for.</param>
/// <returns>The value of the property if the enclosed object is not null; otherwise, <c>null</c>.</returns>
/// <remarks>This API supports the product infrastructure and is not intended to be used directly from your code.</remarks>
public static object DefaultPropertyValueResolver(this IDecorator<object> decorator, PropertyInfo pi)
{
var source = decorator?.Inner;
return source == null
? null
: pi?.GetValue(source, null);
}

/// <summary>
/// Invokes the specified <paramref name="traversal"/> path of the enclosed object of the specified <paramref name="decorator"/> until obstructed by an empty sequence.
/// </summary>
/// <param name="decorator">The <see cref="IDecorator{T}"/> to extend.</param>
/// <param name="traversal">The function delegate that is invoked until the traveled path is obstructed by an empty sequence.</param>
/// <returns>An <see cref="IEnumerable{T}"/> sequence equal to the traveled path of the enclosed object of the specified <paramref name="decorator"/>.</returns>
/// <exception cref="ArgumentNullException">
/// <paramref name="decorator"/> -or- <paramref name="traversal"/> is null.
/// </exception>
public static IEnumerable<TSource> TraverseWhileNotEmpty<TSource>(this IDecorator<TSource> decorator, Func<TSource, IEnumerable<TSource>> traversal) where TSource : class
{
Validator.ThrowIfNull(decorator);
Validator.ThrowIfNull(traversal);

var source = decorator.Inner;
var stack = new Stack<TSource>();
stack.Push(source);
while (stack.Count != 0)
{
var current = stack.Pop();
foreach (var element in traversal(current))
{
stack.Push(element);
}
yield return current;
}
}
}
}
2 changes: 1 addition & 1 deletion src/Cuemon.Core/Extensions/TypeDecoratorExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ public static bool HasCircularReference(this IDecorator<Type> decorator, object
Validator.ThrowIfNull(source);
Validator.ThrowIfLowerThanOrEqual(maxDepth, 0, nameof(maxDepth));
if (source.GetType() != decorator.Inner) { throw new InvalidOperationException("The specified source has a different type than the underlying type of the extended decorator."); }
valueResolver ??= Infrastructure.DefaultPropertyValueResolver;
valueResolver ??= (s, i) => Decorator.RawEnclose(s).DefaultPropertyValueResolver(i);
var hasCircularReference = false;
var currentDepth = 0;
var stack = new Stack<object>();
Expand Down
Loading