Show / Hide Table of Contents

Class DelegateCondition<TModel, TUser>

Condition that uses a delegate to check if it has been met

Inheritance
Object
DelegateCondition<TModel, TUser>
Implements
ICondition<TModel, TUser>
Namespace: Seltzr.Conditions
Assembly: Seltzr.dll
Syntax
C#
public class DelegateCondition<TModel, TUser> : ICondition<TModel, TUser> where TModel : class where TUser : class
Type Parameters
TModel

The type of model in the dataset

TUser

The type of authenticated user

Constructors

| Improve this Doc View Source

DelegateCondition(Func<IApiContext<TModel, TUser>, IQueryable<TModel>, Task<Boolean>>, String)

Initializes a new instance of the DelegateCondition<TModel, TUser> class.

C#
public DelegateCondition(Func<IApiContext<TModel, TUser>, IQueryable<TModel>, Task<bool>> conditionDelegate, string failureMessage = null)
Parameters
conditionDelegateFunc<IApiContext<TModel, TUser>, IQueryable<TModel>, Task<Boolean>>

The delegate to use to check the status of the condition

failureMessageString

The message of the exception to throw when the condition is not met

Properties

| Improve this Doc View Source

FailureMessage

Gets a message indicating why the condition might have failed

C#
public string FailureMessage { get; }
Property Value
String

Methods

| Improve this Doc View Source

VerifyAsync(IApiContext<TModel, TUser>, IQueryable<TModel>)

Verifies that the current request meets a condition

C#
public Task<bool> VerifyAsync(IApiContext<TModel, TUser> context, IQueryable<TModel> dataset)
Parameters
contextIApiContext<TModel, TUser>

The current API context

datasetIQueryable<TModel>

The current dataset to be filtered

Returns

Task<Boolean>

true if the request should continue, false otherwise

Implements

ICondition<TModel, TUser>
  • Improve this Doc
  • View Source
Back to top Generated by DocFX