Class ValidateUtilities
Inheritance
Inherited Members
Namespace: Terrasoft.Common
Assembly: Terrasoft.Common.dll
Syntax
public static class ValidateUtilities
Methods
CheckArgumentEmpty(Guid, String)
Checks if the current UId is empty. If the condition is met, exception is thrown.
Declaration
public static void CheckArgumentEmpty(this Guid source, string argumentName)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | source | Unique identifier. |
System.String | argumentName | Name of the argument that caused exception. |
Exceptions
Type | Condition |
---|---|
ArgumentNullOrEmptyException | If the UId |
CheckArgumentNull(Object, String)
Checks if the current object is null
value. If the condition is met, exception is thrown.
Declaration
public static void CheckArgumentNull(this object source, string argumentName)
Parameters
Type | Name | Description |
---|---|---|
System.Object | source | Entity. |
System.String | argumentName | Name of the argument that caused exception. |
Exceptions
Type | Condition |
---|---|
ArgumentNullOrEmptyException | If the value of the |
CheckArgumentNullOrEmpty(String, String)
Checks if the specified string is empty or null
. If the condition is met, exception is thrown.
Declaration
public static void CheckArgumentNullOrEmpty(this string source, string argumentName)
Parameters
Type | Name | Description |
---|---|---|
System.String | source | String. |
System.String | argumentName | Name of the argument that caused exception. |
Exceptions
Type | Condition |
---|---|
ArgumentNullOrEmptyException | If the |
CheckArgumentNullOrEmpty<T>(IEnumerable<T>, String)
Checks if the source
enumerator is empty or null
. If the condition is met, exception is thrown.
Declaration
public static void CheckArgumentNullOrEmpty<T>(this IEnumerable<T> source, string argumentName)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T> | source | Object enumerator. |
System.String | argumentName | Name of the argument that caused exception. |
Type Parameters
Name | Description |
---|---|
T | A class that implements the System.Collections.Generic.IEnumerable<T> interface. |
Exceptions
Type | Condition |
---|---|
ArgumentNullOrEmptyException | If the |
CheckArgumentNullOrWhiteSpace(String, String)
Validates whether a specified string is null
, empty, or consists only of white-space characters.
If condition is true, exception will be thrown.
Declaration
public static void CheckArgumentNullOrWhiteSpace(this string source, string argumentName)
Parameters
Type | Name | Description |
---|---|---|
System.String | source | String. |
System.String | argumentName | Name of the argument that causes exception. |
Exceptions
Type | Condition |
---|---|
ArgumentNullOrEmptyException | If string |
CheckDependencyNull(Object, String)
Checks if current object is null
. If condition is true, exception will be thrown.
Declaration
public static void CheckDependencyNull(this object source, string dependencyName)
Parameters
Type | Name | Description |
---|---|---|
System.Object | source | Object. |
System.String | dependencyName | Dependency name. |
Exceptions
Type | Condition |
---|---|
InvalidObjectStateException | If value of parameter |
EnsureDependencyNotNull<T>(T, String)
Checks if dependency is null
. If condition is true, exception will be thrown.
Declaration
public static T EnsureDependencyNotNull<T>(this T source, string dependencyName)
where T : class
Parameters
Type | Name | Description |
---|---|---|
T | source | |
System.String | dependencyName |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
Exceptions
Type | Condition |
---|---|
InvalidObjectStateException |