Class SpecificationEx
Class containing some extension methods for ISpecification<T>.
Inheritance
Inherited Members
Namespace:Extend
Assembly:Extend.dll
Syntax
public static class SpecificationEx
Methods
| Improve this Doc View SourceAnd<T>(ISpecification<T>, Func<T, Boolean>, String)
Combines the current specification with the given expression using an AND link.
Declaration
public static ISpecification<T> And<T>(this ISpecification<T> specification, Func<T, bool> expression, string message = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ISpecification<T><T> | specification | The current specification. |
| System.Func<T, TResult><T, System.Boolean> | expression | The expression to add. |
| System.String | message | The validation error message. |
Returns
| Type | Description |
|---|---|
| ISpecification<T><T> | Returns the combined specifications. |
Type Parameters
| Name | Description |
|---|---|
| T | The target type of the specification. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | specification can not be null. |
| System.ArgumentNullException | expression can not be null. |
Or<T>(ISpecification<T>, Func<T, Boolean>, String)
Combines the current specification with the given expression using a OR link.
Declaration
public static ISpecification<T> Or<T>(this ISpecification<T> specification, Func<T, bool> expression, string message = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ISpecification<T><T> | specification | The current specification. |
| System.Func<T, TResult><T, System.Boolean> | expression | The expression to add. |
| System.String | message | The validation error message. |
Returns
| Type | Description |
|---|---|
| ISpecification<T><T> | Returns the combined specifications. |
Type Parameters
| Name | Description |
|---|---|
| T | The target type of the specification. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | specification can not be null. |
| System.ArgumentNullException | expression can not be null. |
XOr<T>(ISpecification<T>, Func<T, Boolean>, String)
Combines the current specification with the given expression using a XOr link.
Declaration
public static ISpecification<T> XOr<T>(this ISpecification<T> specification, Func<T, bool> expression, string message = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ISpecification<T><T> | specification | The current specification. |
| System.Func<T, TResult><T, System.Boolean> | expression | The expression to add. |
| System.String | message | The validation error message. |
Returns
| Type | Description |
|---|---|
| ISpecification<T><T> | Returns the combined specifications. |
Type Parameters
| Name | Description |
|---|---|
| T | The target type of the specification. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | specification can not be null. |
| System.ArgumentNullException | expression can not be null. |