Class FluentExtensions
Provides extension methods for fluent validation and processing of objects.
public static class FluentExtensions
- Inheritance
-
FluentExtensions
- Inherited Members
Methods
Failure<T>(T)
Marks the operation as failed with the provided value.
public static FluentResult<T> Failure<T>(this T value)
Parameters
valueTThe value to be wrapped.
Returns
- FluentResult<T>
A FluentResult<T> indicating failure.
Type Parameters
TThe type of the value.
IsEqualTo<T, CT>(T, CT)
Checks if the provided value is equal to the comparison value.
public static FluentResult<T> IsEqualTo<T, CT>(this T value, CT comparisonValue)
Parameters
valueTThe value to check.
comparisonValueCTThe value to compare against.
Returns
- FluentResult<T>
A FluentResult<T> indicating whether the values are equal.
Type Parameters
TThe type of the value.
CTThe type of the comparison value.
IsGreaterOrEqualsThan<T, CT>(T, CT)
Checks if the provided value is greater than or equal to the comparison value.
public static FluentResult<T> IsGreaterOrEqualsThan<T, CT>(this T value, CT comparisonValue)
Parameters
valueTThe value to check.
comparisonValueCTThe value to compare against.
Returns
- FluentResult<T>
A FluentResult<T> indicating whether the value is greater than or equal to the comparison value.
Type Parameters
TThe type of the value.
CTThe type of the comparison value.
IsGreaterThan<T, CT>(T, CT)
Checks if the provided value is greater than the comparison value.
public static FluentResult<T> IsGreaterThan<T, CT>(this T value, CT comparisonValue)
Parameters
valueTThe value to check.
comparisonValueCTThe value to compare against.
Returns
- FluentResult<T>
A FluentResult<T> indicating whether the value is greater than the comparison value.
Type Parameters
TThe type of the value.
CTThe type of the comparison value.
IsIn<T>(T, params T[])
Checks if the provided value is present in a list of values.
public static FluentResult<T> IsIn<T>(this T value, params T[] values)
Parameters
valueTThe value to check.
valuesT[]An array of values to check against.
Returns
- FluentResult<T>
A FluentResult<T> indicating whether the value is in the list.
Type Parameters
TThe type of the value.
IsLowerOrEqualsThan<T, CT>(T, CT)
Checks if the provided value is less than or equal to the comparison value.
public static FluentResult<T> IsLowerOrEqualsThan<T, CT>(this T value, CT comparisonValue)
Parameters
valueTThe value to check.
comparisonValueCTThe value to compare against.
Returns
- FluentResult<T>
A FluentResult<T> indicating whether the value is less than or equal to the comparison value.
Type Parameters
TThe type of the value.
CTThe type of the comparison value.
IsLowerThan<T, CT>(T, CT)
Checks if the provided value is less than the comparison value.
public static FluentResult<T> IsLowerThan<T, CT>(this T value, CT comparisonValue)
Parameters
valueTThe value to check.
comparisonValueCTThe value to compare against.
Returns
- FluentResult<T>
A FluentResult<T> indicating whether the value is less than the comparison value.
Type Parameters
TThe type of the value.
CTThe type of the comparison value.
IsNotIn<T>(T, params T[])
Checks if the provided value is not present in a list of values.
public static FluentResult<T> IsNotIn<T>(this T value, params T[] values)
Parameters
valueTThe value to check.
valuesT[]An array of values to check against.
Returns
- FluentResult<T>
A FluentResult<T> indicating whether the value is not in the list.
Type Parameters
TThe type of the value.
IsNotNull<T>(T)
Checks if the provided value is not null.
public static FluentResult<T> IsNotNull<T>(this T value)
Parameters
valueTThe value to check.
Returns
- FluentResult<T>
A FluentResult<T> indicating whether the value is not null.
Type Parameters
TThe type of the value.
IsNull<T>(T)
Checks if the provided value is null.
public static FluentResult<T> IsNull<T>(this T value)
Parameters
valueTThe value to check.
Returns
- FluentResult<T>
A FluentResult<T> indicating whether the value is null.
Type Parameters
TThe type of the value.
NullOrEmptyToNull(string)
Converts an empty or null string to null.
public static string NullOrEmptyToNull(this string value)
Parameters
valuestringThe string to check.
Returns
- string
Null if the string is null or empty, otherwise the original string.
NullOrEmptyToNull(FluentResult<string>)
Converts an empty or null string to null within a FluentResult<T>.
public static FluentResult<string> NullOrEmptyToNull(this FluentResult<string> value)
Parameters
valueFluentResult<string>The fluent result containing the string.
Returns
- FluentResult<string>
A new FluentResult<T> with the string converted to null if it was null or empty.
NullOrWhiteSpaceToNull(string)
Converts a whitespace-only or null string to null.
public static string NullOrWhiteSpaceToNull(this string value)
Parameters
valuestringThe string to check.
Returns
- string
Null if the string is null or contains only whitespace, otherwise the original string.
NullOrWhiteSpaceToNull(FluentResult<string>)
Converts a whitespace-only or null string to null within a FluentResult<T>.
public static FluentResult<string> NullOrWhiteSpaceToNull(this FluentResult<string> value)
Parameters
valueFluentResult<string>The fluent result containing the string.
Returns
- FluentResult<string>
A new FluentResult<T> with the string converted to null if it was null or whitespace-only.
Success<T>(T)
Marks the operation as successful with the provided value.
public static FluentResult<T> Success<T>(this T value)
Parameters
valueTThe value to be wrapped.
Returns
- FluentResult<T>
A FluentResult<T> indicating success.
Type Parameters
TThe type of the value.
Test<T>(T, Func<T, bool>)
Checks if the provided value satisfies a given predicate.
public static FluentResult<T> Test<T>(this T value, Func<T, bool> test)
Parameters
Returns
- FluentResult<T>
A FluentResult<T> indicating whether the predicate is satisfied.
Type Parameters
TThe type of the value.