Releases: HarinezumiSama/Omnifactotum
Releases · HarinezumiSama/Omnifactotum
v0.22.0 [2024-09-03 UTC]
NuGet Package
Changes in 0.22.0 (since 0.21.0)
Breaking changes
OmnifactotumStringBuilderExtensions
: Fixed namespace:System
->System.Text
Changes in 0.21.0 (since 0.20.0)
New features
- Added
OmnifactotumStringBuilderExtensions
withStringBuilder AppendUIString(this StringBuilder, string?)
andStringBuilder AppendSecuredUIString(this StringBuilder, string?, int, int)
ObjectValidator
: AddedEnsureValid<T>(...)
method (shortcut forObjectValidator.Validate(...).EnsureSucceeded()
)- Added
KeyedComparer<T, TKey>
(implementsIComparer<T>
andIComparer
) - Added
OmnifactotumNullableCharExtensions
withToUIString(this char? value)
method OmnifactotumStringExtensions
: AddedToTitleCase(this string?, CultureInfo?)
ToTitleCaseForced(this string?, CultureInfo?)
ToTitleCaseInvariant(this string?)
ToTitleCaseInvariantForced(this string?)
OmnifactotumExceptionExtensions
: AddedEnumerateRecursively(this Exception?)
extension method
Updates and fixes
- Applied
MeansImplicitUse
annotation toTMemberConstraint
inMemberConstraintAttribute<TMemberConstraint>
- Optimized
OmnifactotumCharExtensions.ToUIString(this char)
IsOriginatedFrom<TOriginatingException>(this Exception?)
andIsOriginatedFrom(this Exception?, Type)
are now usingOmnifactotumExceptionExtensions.EnumerateRecursively(this Exception?)
v0.21.0 [2024-08-30 UTC]
NuGet Package
Changes in 0.21.0 (since 0.20.0)
New features
- Added
OmnifactotumStringBuilderExtensions
withStringBuilder AppendUIString(this StringBuilder, string?)
andStringBuilder AppendSecuredUIString(this StringBuilder, string?, int, int)
ObjectValidator
: AddedEnsureValid<T>(...)
method (shortcut forObjectValidator.Validate(...).EnsureSucceeded()
)- Added
KeyedComparer<T, TKey>
(implementsIComparer<T>
andIComparer
) - Added
OmnifactotumNullableCharExtensions
withToUIString(this char? value)
method OmnifactotumStringExtensions
: AddedToTitleCase(this string?, CultureInfo?)
ToTitleCaseForced(this string?, CultureInfo?)
ToTitleCaseInvariant(this string?)
ToTitleCaseInvariantForced(this string?)
OmnifactotumExceptionExtensions
: AddedEnumerateRecursively(this Exception?)
extension method
Updates and fixes
- Applied
MeansImplicitUse
annotation toTMemberConstraint
inMemberConstraintAttribute<TMemberConstraint>
- Optimized
OmnifactotumCharExtensions.ToUIString(this char)
IsOriginatedFrom<TOriginatingException>(this Exception?)
andIsOriginatedFrom(this Exception?, Type)
are now usingOmnifactotumExceptionExtensions.EnumerateRecursively(this Exception?)
v0.20.0 [2024-05-23 UTC]
NuGet Package
Changes in 0.20.0 (since 0.19.0)
Breaking changes
- Object validation
- Moved validation attributes from the namespace
Omnifactotum.Validation.Constraints
toOmnifactotum.Validation.Annotations
BaseMemberConstraintAttribute
BaseValidatableMemberAttribute
MemberConstraintAttribute
MemberConstraintAttribute<T>
(.NET 7+)MemberItemConstraintAttribute
MemberItemConstraintAttribute<T>
(.NET 7+)ValidatableMemberAttribute
MemberConstraintExtensions
AddError(this IMemberConstraint, MemberConstraintValidationContext, string?)
->AddError(this IMemberConstraint, MemberConstraintValidationContext, ValidationErrorDetails?)
MemberConstraintBase
AddError(MemberConstraintValidationContext, string?)
->AddError(MemberConstraintValidationContext, ValidationErrorDetails?)
- Removed obsolete method
AddError(ObjectValidatorContext, MemberConstraintValidationContext, string)
- Removed obsolete method
AddDefaultError(ObjectValidatorContext, MemberConstraintValidationContext)
- Moved validation attributes from the namespace
New features
- Object validation
- Added
ValidationErrorDetails
with theText
andDescription
properties (used inMemberConstraintBase.AddError()
andMemberConstraintExtensions.AddError()
)- A
string
value can be implicitly converted toValidationErrorDetails
- A
- Object validation: Added constraints
NotNullAndNotBlankStringConstraint
(replacesNotBlankStringConstraint
)NotNullAndNotEmptyCollectionConstraint
(replacesNotNullOrEmptyCollectionConstraint
)NotNullAndNotEmptyCollectionConstraint<T>
(replacesNotNullOrEmptyCollectionConstraint<T>
)NotNullAndNotEmptyStringConstraint
(replacesNotNullOrEmptyStringConstraint
)NotNullRegexStringConstraintBase
(replacesRegexStringConstraintBase
)NotNullWebUrlConstraint
(replacesWebUrlConstraint
)OptionalNotBlankStringConstraint
OptionalNotEmptyCollectionConstraint
OptionalNotEmptyCollectionConstraint<T>
OptionalNotEmptyStringConstraint
OptionalRegexStringConstraintBase
OptionalWebUrlConstraint
- Added
Deprecations
- Object validation
MemberConstraintValidationError
- The
ErrorMessage
property is deprecated in favor of theDetails
property of typeValidationErrorDetails
(ErrorMessage
is equivalent toDetails.Text
)
- The
- Deprecated constraints
NotBlankStringConstraint
in favor ofNotNullAndNotBlankStringConstraint
NotNullOrEmptyCollectionConstraint
in favor ofNotNullAndNotEmptyCollectionConstraint
NotNullOrEmptyCollectionConstraint<T>
in favor ofNotNullAndNotEmptyCollectionConstraint<T>
NotNullOrEmptyStringConstraint
in favor ofNotNullAndNotEmptyStringConstraint
RegexStringConstraintBase
in favor ofNotNullRegexStringConstraintBase
WebUrlConstraint
in favor ofNotNullWebUrlConstraint
v0.19.0 [2024-02-15 UTC]
NuGet Package
Changes in 0.19.0 (since 0.18.0)
Breaking changes
- Object validation:
- Removed
ValidationErrorCollection
ObjectValidatorContext
: Removed theErrors
property from public API- Removed deprecated methods in
OmnifactotumTypeExtensions
:IsNullable()
(IsNullableValueType()
to be used instead)GetCollectionElementType()
(GetCollectionElementTypeOrDefault()
to be used instead)
IMemberConstraint
: ReplacedValidate(ObjectValidatorContext, MemberConstraintValidationContext, object?)
withValidate(MemberConstraintValidationContext, object?)
sinceMemberConstraintValidationContext
now has a reference toObjectValidatorContext
MemberConstraintBase
:- Replaced
ValidateValue(ObjectValidatorContext, MemberConstraintValidationContext, object?)
withValidateValue(MemberConstraintValidationContext, object?)
- Replaced
TypedMemberConstraintBase<T>
:- Replaced
ValidateTypedValue(ObjectValidatorContext, MemberConstraintValidationContext, T value)
withValidateTypedValue(MemberConstraintValidationContext, T value)
- Replaced
ValidateMember<TMember>(ObjectValidatorContext, MemberConstraintValidationContext, T, Expression<Func<T, TMember>>, Type)
withValidateMember<TMember>(MemberConstraintValidationContext, T, Expression<Func<T, TMember>>, Type)
- Replaced
- Removed
New features
- Object validation:
- Added generic
MemberConstraintAttribute<TMemberConstraint>
andMemberItemConstraintAttribute<TMemberConstraint>
(.NET 7+) ObjectValidationResult
: Added theFailureMessage
property (and used it inGetException()
)
- Added generic
OmnifactotumCollectionExtensions
: AddedToUIString()
forIEnumerable<KeyValuePair<string, string?>>?
Updates and fixes
- Object validation:
- Improved the failure message in
NotNullConstraint<T>
(included theT
type name) MemberConstraintValidationContext
: Added a reference toObjectValidatorContext
- Improved the failure message in
OmnifactotumCollectionExtensions
andOmnifactotumStringExtensions
: Implemented safe processing of collections w.r.t.ImmutableArray<T>
- Applied
DebuggerDisplay
annotation:FixedSizeDictionary<TKey, TValue, TDeterminant>
ReadOnlyItemCollection<T>
ReadOnlySet<T>
RecursiveProcessingContext
SemaphoreSlimBasedLock
StopwatchElapsedTimeProvider
TemplatedStringResolver
- Validation:
MemberConstraintValidationContext
ObjectValidationException
ObjectValidationResult
ObjectValidatorContext
ValidationErrorCollection
v0.18.0 [2024-01-02 UTC]
NuGet Package
Changes in 0.18.0 (since 0.17.0)
Breaking changes
- Object Validation
NotNullConstraint
is now inherited fromMemberConstraintBase
instead ofNotNullConstraint<object>
NotNullConstraint<T>
is now sealed- Removed
Omnifactotum.Validation.ObjectValidationResult.GetException(Func<...>, string?)
- Removed
Omnifactotum.Validation.Constraints.MemberConstraintValidationError.GetDefaultDescription()
- Removed
Omnifactotum.Validation.Constraints.MemberConstraintValidationError.GetDefaultDescription(MemberConstraintValidationError)
- Member constraint's constructor can now be non-public
New features
- Object Validation
- Implemented support for
ImmutableArray<T>
in member constraints:NotNullConstraint
NotNullConstraint<T>
NotNullOrEmptyCollectionConstraint
NotNullOrEmptyCollectionConstraint<T>
- Implemented support for
OmnifactotumTypeExtensions
- Added
GetInterfaceMethodImplementation(this Type, MethodInfo)
- Added
Updates and fixes
- Object Validation
- Improved/added support for
ImmutableArray<T>
,IReadOnlyList<T>
,IList<T>
,IEnumerable<T>
, andIList
- Improved type casting in expressions
- Improved message format of the exception created by
ObjectValidationResult.GetException()
- Validating early that a member constraint has a parameterless constructor
- Slightly optimized member constraint creation
- Improved/added support for
v0.17.0 [2023-10-18 UTC]
NuGet Package
Changes in 0.17.0 (since 0.16.0)
New features
- Added
OmnifactotumCharExtensions
ToUIString(this char value)
- Added
OmnifactotumSpanExtensions
ToHexString(this Span<byte> bytes, ...)
TransformMultilineString(...)
- Added
ValueRangeExtensions
Enumerate<T>(...)
ToArray<T>(...)
OmnifactotumReadOnlySpanExtensions
- Added
TransformMultilineString(...)
- Added
OmnifactotumStringExtensions
- Added
EnsureNotBlank<T>
- Added
EnsureNotEmpty<T>
- Added
TransformMultilineString(...)
- Added
- Validation
- Added
NullableValueRangeConstraintBase<T>
constraint - Added
OptionalEnumValueDefinedConstraint<T>
constraint - Added
OptionalValueRangeConstraintBase<T>
constraint
- Added
Minor updates and fixes
- Applied
System.Diagnostics.Contracts.PureAttribute
,Omnifactotum.Annotations.Pure
, and/orOmnifactotum.Annotations.MustUseReturnValueAttribute
annotations where reasonable - Applied
Omnifactotum.Annotations.NotNullAttribute
where reasonable - Fixed/improved XML-documentation in:
NullableEnumValueDefinedConstraint<TEnum>
OmnifactotumStringExtensions
- Minor code style fixes/improvements
v0.16.0 [2023-06-23 UTC]
NuGet Package
Changes in 0.16.0 (since 0.15.0)
Breaking Changes
OmnifactotumArrayExtensions
: RemovedToHexString(this byte[], bool)
andToHexString(this byte[])
in favor ofToHexString(this byte[] bytes, string? separator = null, bool upperCase = false)
New features
MemberConstraintBase
: Added the static protected methodstring FormatValue<TValue>(TValue value)
(used inEnumValueDefinedConstraint<TEnum>
,NullableEnumValueDefinedConstraint<TEnum>
,RegexStringConstraintBase
,ValueRangeConstraintBase<T>
, andWebUrlConstraint
to format the invalid value and valid value(s))OmnifactotumEnumExtensions
- Added the
string GetDescription<TEnum>(this TEnum)
extension method - Added the
ulong ToUInt64<TEnum>(this TEnum)
extension method
- Added the
OmnifactotumImmutableArrayExtensions
- Added the
AvoidNullOrDefault<T>(this ImmutableArray<T>?)
extension method
- Added the
- Added
OmnifactotumReadOnlySpanExtensions
with theToHexString(this ReadOnlySpan<byte> bytes, string? separator = null, bool useUpperCase = false)
extension method ValueRange<T>
- Added the
string ToString(string boundarySeparator)
method - .NET 7+:
ValueRange<T>
implementsIEqualityOperators<ValueRange<T>, ValueRange<T>, bool>
- Added the
ValueRangeConstraintBase<T>
: Added constructorValueRangeConstraintBase(T lower, T upper)
Minor updates and fixes
OmnifactotumArrayExtensions
ToHexString(this byte[], string?, bool)
is now optimized compared to the older implementation (less heap allocations)
EnumFactotum
: Fix inGetAllFlagValues<TEnum>()
ValueRange<T>
string ToString()
: Changed the result format from[Lower; Upper]
to[Lower ~ Upper]
ValueRangeConstraintBase<T>
: Included invalid value in the error message
v0.15.0 [2023-06-01 UTC]
NuGet Package
Changes in 0.15.0 (since 0.14.1)
Breaking Changes
ObjectValidator.Validate()
method: AddedinstanceExpression
parameter- For .NET 5+ and higher, the
instanceExpression
parameter is marked with theCallerArgumentExpression
attribute - For the older .NET versions, the
instanceExpression
parameter is supplied only for binary compatibility between the different target frameworks
- For .NET 5+ and higher, the
New features
ElapsedTimeProviderExtensions
: Added theGetStoppedElapsed()
extension methodOmnifactotumCollectionExtensions
: Added theFlatten()
extension methodOmnifactotumEnumExtensions
: Added theToUIString()
extension methodOmnifactotumExceptionExtensions
: Added theIsOriginatedFrom(this Exception?, Type)
extension method- Added
OmnifactotumStopwatchExtensions
with theGetStoppedElapsed()
extension method OmnifactotumStringExtensions
: Added new extension methods forSystem.String
:WithSingleLeadingSlash(string)
WithoutLeadingSlash(string)
- Object validation
- Added
RegexStringConstraintBase
- Added
ValueRangeConstraintBase<T>
- Added
Minor updates and fixes
- Applied
MeansImplicitUse
annotations toTKeyConstraint
andTValueConstraint
inKeyValuePairConstraint<TKey, TValue, TKeyConstraint, TValueConstraint>
v0.14.1 [2023-05-01 UTC]
NuGet Package
Changes in 0.14.1 (since 0.14.0)
Minor updates and fixes
- Improvements in
Factotum.Assert(...)
- The
DoesNotReturnIf
attribute has been applied on thecondition
parameter - Now the method referenced by the
createAssertionFailureException
parameter can returnnull
(OmnifactotumAssertionException
is used in this case)
- The
- Minor improvements in XML documentation in
OmnifactotumMethodBaseExtensions
andOmnifactotumTypeExtensions
v0.14.0 [2023-03-20 UTC]
NuGet Package
Changes in 0.14.0 (since 0.13.0)
Breaking Changes
- Dropped support of .NET Framework 4.7.2 and .NET Standard 2.0
- .NET 7+: Removed the following extension methods since the analogous ones are available since .NET 7:
OmnifactotumCollectionExtensions
AsReadOnly<T>(this IList<T>)
OmnifactotumDictionaryExtensions
AsReadOnly<TKey, TValue>(this IDictionary<TKey, TValue>)
New features
- Implemented compiling package for .NET 7