Extensions
Useful extensions
Assembly: ServiceStack.dll
View Source
public static class Extensions
Methods
IsParameterExpression(LambdaExpression)
Checks if the expression is a parameter expression
View Source
public static bool IsParameterExpression(this LambdaExpression expression)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.Linq.Expressions.LambdaExpression | expression |
GetMember(LambdaExpression)
Gets a MemberInfo from a member expression.
View Source
public static MemberInfo GetMember(this LambdaExpression expression)
Returns
System.Reflection.MemberInfo
Parameters
Type | Name |
---|---|
System.Linq.Expressions.LambdaExpression | expression |
GetMember<T, TProperty>(Expression<Func<T, TProperty>>)
Gets a MemberInfo from a member expression.
View Source
public static MemberInfo GetMember<T, TProperty>(this Expression<Func<T, TProperty>> expression)
Returns
System.Reflection.MemberInfo
Parameters
Type | Name |
---|---|
System.Linq.Expressions.Expression<System.Func<<T>,<TProperty>>> | expression |
Type Parameters
T
TProperty
SplitPascalCase(String)
Splits pascal case, so "FooBar" would become "Foo Bar"
View Source
public static string SplitPascalCase(this string input)
Returns
System.String
Parameters
Type | Name |
---|---|
System.String | input |
CoerceToNonGeneric<T, TProperty>(Func<T, TProperty>)
View Source
public static Func<object, object> CoerceToNonGeneric<T, TProperty>(this Func<T, TProperty> func)
Returns
System.Func<System.Object,System.Object>
Parameters
Type | Name |
---|---|
System.Func<<T>,<TProperty>> | func |
Type Parameters
T
TProperty
CoerceToNonGeneric<T>(Func<T, Boolean>)
View Source
public static Func<object, bool> CoerceToNonGeneric<T>(this Func<T, bool> func)
Returns
System.Func<System.Object,System.Boolean>
Parameters
Type | Name |
---|---|
System.Func<<T>,System.Boolean> | func |
Type Parameters
T
CoerceToNonGeneric<T>(Func<T, CancellationToken, Task<Boolean>>)
View Source
public static Func<object, CancellationToken, Task<bool>> CoerceToNonGeneric<T>(this Func<T, CancellationToken, Task<bool>> func)
Returns
System.Func<System.Object,System.Threading.CancellationToken,System.Threading.Tasks.Task<System.Boolean>>
Parameters
Type | Name |
---|---|
System.Func<<T>,System.Threading.CancellationToken,System.Threading.Tasks.Task<System.Boolean>> | func |
Type Parameters
T
CoerceToNonGeneric<T>(Func<T, Task<Boolean>>)
View Source
public static Func<object, Task<bool>> CoerceToNonGeneric<T>(this Func<T, Task<bool>> func)
Returns
System.Func<System.Object,System.Threading.Tasks.Task<System.Boolean>>
Parameters
Type | Name |
---|---|
System.Func<<T>,System.Threading.Tasks.Task<System.Boolean>> | func |
Type Parameters
T
CoerceToNonGeneric<T>(Func<T, Int32>)
View Source
public static Func<object, int> CoerceToNonGeneric<T>(this Func<T, int> func)
Returns
System.Func<System.Object,System.Int32>
Parameters
Type | Name |
---|---|
System.Func<<T>,System.Int32> | func |
Type Parameters
T
CoerceToNonGeneric<T>(Func<T, Int64>)
View Source
public static Func<object, long> CoerceToNonGeneric<T>(this Func<T, long> func)
Returns
System.Func<System.Object,System.Int64>
Parameters
Type | Name |
---|---|
System.Func<<T>,System.Int64> | func |
Type Parameters
T
CoerceToNonGeneric<T>(Func<T, String>)
View Source
public static Func<object, string> CoerceToNonGeneric<T>(this Func<T, string> func)
Returns
System.Func<System.Object,System.String>
Parameters
Type | Name |
---|---|
System.Func<<T>,System.String> | func |
Type Parameters
T
CoerceToNonGeneric<T>(Func<T, Regex>)
View Source
public static Func<object, Regex> CoerceToNonGeneric<T>(this Func<T, Regex> func)
Returns
System.Func<System.Object,System.Text.RegularExpressions.Regex>
Parameters
Type | Name |
---|---|
System.Func<<T>,System.Text.RegularExpressions.Regex> | func |
Type Parameters
T
CoerceToNonGeneric<T>(Action<T>)
View Source
public static Action<object> CoerceToNonGeneric<T>(this Action<T> action)
Returns
System.Action<System.Object>
Parameters
Type | Name |
---|---|
System.Action<<T>> | action |
Type Parameters
T
IsAsync(IValidationContext)
Checks whether this is an asynchronous validation run.
View Source
public static bool IsAsync(this IValidationContext ctx)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.FluentValidation.IValidationContext | ctx |