Operators

Operators can be used with observables or other operators. They are a combination of observer and observable. This means that the description for Observables also applies.

ApplyFilterByClientRequest

Apply filter logic to the received IQueryable<TSource>.

Matches the query parameters with the keys of the given filter dictionary. Implement IFilterByClientRequestInterpreter for custom behavior.

Requires HttpContextProviderAttribute to be set.

Package: FluentRestBuilder

public static IProviderObservable<IQueryable<TSource>> ApplyFilterByClientRequest<TSource>(
    this IProviderObservable<IQueryable<TSource>> observable,
    Func<FilterExpressionProviderDictionary<TSource>,IFilterExpressionProviderDictionary<TSource>> factory)

Apply filter logic to the received IQueryable<TSource>. Tries to resolve IFilterExpressionProviderDictionary<TSource> via IServiceProvider.

Matches the query parameters with the keys of the given filter dictionary. Implement IFilterByClientRequestInterpreter for custom behavior.

Requires HttpContextProviderAttribute to be set.

Package: FluentRestBuilder

public static IProviderObservable<IQueryable<TSource>> ApplyFilterByClientRequest<TSource>(
    this IProviderObservable<IQueryable<TSource>> observable)

Apply filter logic to the received IQueryable<TSource>.

Matches the query parameters with the keys of the given filter dictionary. Implement IFilterByClientRequestInterpreter for custom behavior.

Requires HttpContextProviderAttribute to be set.

Package: FluentRestBuilder

public static IProviderObservable<IQueryable<TSource>> ApplyFilterByClientRequest<TSource>(
    this IProviderObservable<IQueryable<TSource>> observable,
    IDictionary<string,IFilterExpressionProvider<TSource>> filterDictionary)

ApplyOrderByClientRequest

Apply order by logic to the received IQueryable<TSource>.

The default query parameter key is “sort”. A comma-separated list of properties is supported. Prefix the property with “-” to sort descending. Implement IOrderByClientRequestInterpreter for custom behavior.

Requires HttpContextProviderAttribute to be set.

Package: FluentRestBuilder

public static IProviderObservable<IQueryable<TSource>> ApplyOrderByClientRequest<TSource>(
    this IProviderObservable<IQueryable<TSource>> observable,
    Func<OrderByExpressionDictionary<TSource>,IOrderByExpressionDictionary<TSource>> factory)

Apply order by logic to the received IQueryable<TSource>. Tries to resolve IOrderByExpressionDictionary<TSource> via IServiceProvider.

The default query parameter key is “sort”. A comma-separated list of properties is supported. Prefix the property with “-” to sort descending. Implement IOrderByClientRequestInterpreter for custom behavior.

Requires HttpContextProviderAttribute to be set.

Package: FluentRestBuilder

public static IProviderObservable<IQueryable<TSource>> ApplyOrderByClientRequest<TSource>(
    this IProviderObservable<IQueryable<TSource>> observable)

Apply order by logic to the received IQueryable<TSource>. Provide a dictionary with provided order by expressions.

The default query parameter key is “sort”. A comma-separated list of properties is supported. Prefix the property with “-” to sort descending. Implement IOrderByClientRequestInterpreter for custom behavior.

Requires HttpContextProviderAttribute to be set.

Package: FluentRestBuilder

public static IProviderObservable<IQueryable<TSource>> ApplyOrderByClientRequest<TSource>(
    this IProviderObservable<IQueryable<TSource>> observable,
    IDictionary<string,IOrderByExpressionFactory<TSource>> orderByExpressions)

ApplyPaginationByClientRequest

Configure the pagination capabilities.

WARNING: Do not use this before FilterByClientRequest, SearchByClientRequest or OrderByClientRequest! This would result in erroneous pagination logic.

Requires HttpContextProviderAttribute to be set.

Package: FluentRestBuilder

public static IProviderObservable<IQueryable<TSource>> ApplyPaginationByClientRequest<TSource>(
    this IProviderObservable<IQueryable<TSource>> observable,
    FluentRestBuilder.Operators.ClientRequest.PaginationOptions options)

ApplySearchByClientRequest

Apply a global search to the received IQueryable<TSource>.

The default query parameter key is “q”. Implement ISearchByClientRequestInterpreter for custom behavior.

Requires HttpContextProviderAttribute to be set.

Package: FluentRestBuilder

public static IProviderObservable<IQueryable<TSource>> ApplySearchByClientRequest<TSource>(
    this IProviderObservable<IQueryable<TSource>> observable,
    Func<string,Expression<Func<TSource,System.Boolean>>> searchExpression)

AsNoTracking

Returns a new query where the change tracker will not track any of the entities that are returned. If the entity instances are modified, this will not be detected by the change tracker and SaveChanges will not persist those changes to the database.

Disabling change tracking is useful for read-only scenarios because it avoids the overhead of setting up change tracking for each entity instance. You should not disable change tracking if you want to manipulate entity instances and persist those changes to the database using SaveChanges.

Identity resolution will still be performed to ensure that all occurrences of an entity with a given key in the result set are represented by the same entity instance.

The default tracking behavior for queries can be controlled by QueryTrackingBehavior.

Package: FluentRestBuilder.EntityFrameworkCore

public static IProviderObservable<IQueryable<TSource>> AsNoTracking<TSource>(
    this IProviderObservable<IQueryable<TSource>> observable)

BadRequestWhen

If the check returns true, ValidationException is emitted as an error with the status code 400 (Bad Request). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> BadRequestWhen<TSource>(
    this IProviderObservable<TSource> observable,
    Func<TSource,System.Boolean> invalidCheck,
    Func<TSource,object> errorFactory)

If the check returns true, ValidationException is emitted as an error with the status code 400 (Bad Request). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> BadRequestWhen<TSource>(
    this IProviderObservable<TSource> observable,
    Func<TSource,System.Boolean> invalidCheck,
    object error)

If the check returns true, ValidationException is emitted as an error with the status code 400 (Bad Request). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> BadRequestWhen<TSource>(
    this IProviderObservable<TSource> observable,
    Func<System.Boolean> invalidCheck,
    Func<TSource,object> errorFactory)

If the check returns true, ValidationException is emitted as an error with the status code 400 (Bad Request). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> BadRequestWhen<TSource>(
    this IProviderObservable<TSource> observable,
    Func<System.Boolean> invalidCheck,
    object error)

BadRequestWhenAsync

If the check returns true, ValidationException is emitted as an error with the status code 400 (Bad Request). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> BadRequestWhenAsync<TSource>(
    this IProviderObservable<TSource> observable,
    Func<TSource,Task<System.Boolean>> invalidCheck,
    Func<TSource,object> errorFactory)

If the check returns true, ValidationException is emitted as an error with the status code 400 (Bad Request). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> BadRequestWhenAsync<TSource>(
    this IProviderObservable<TSource> observable,
    Func<TSource,Task<System.Boolean>> invalidCheck,
    object error)

If the check returns true, ValidationException is emitted as an error with the status code 400 (Bad Request). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> BadRequestWhenAsync<TSource>(
    this IProviderObservable<TSource> observable,
    Func<Task<System.Boolean>> invalidCheck,
    Func<TSource,object> errorFactory)

If the check returns true, ValidationException is emitted as an error with the status code 400 (Bad Request). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> BadRequestWhenAsync<TSource>(
    this IProviderObservable<TSource> observable,
    Func<Task<System.Boolean>> invalidCheck,
    object error)

BadRequestWhenModelStateIsInvalid

If the check returns true, ValidationException is emitted as an error with the status code 400 (Bad Request). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> BadRequestWhenModelStateIsInvalid<TSource>(
    this IProviderObservable<TSource> observable,
    Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary modelState)

CacheInDistributedCache

Cache the received value in IDistributedCache with the given key. If an entry with the given key is found in the cache, it will be emitted and the previous chain is skipped.

Package: FluentRestBuilder.Caching

public static IProviderObservable<TSource> CacheInDistributedCache<TSource>(
    this IProviderObservable<TSource> observable,
    string key)

Cache the received value in IDistributedCache with the given key and the defined absolute expiration moment. If an entry with the given key is found in the cache, it will be emitted and the previous chain is skipped.

Package: FluentRestBuilder.Caching

public static IProviderObservable<TSource> CacheInDistributedCache<TSource>(
    this IProviderObservable<TSource> observable,
    string key,
    System.DateTimeOffset absoluteExpiration)

Cache the received value in IDistributedCache with the given key and the defined absolute expiration moment. If an entry with the given key is found in the cache, it will be emitted and the previous chain is skipped.

Package: FluentRestBuilder.Caching

public static IProviderObservable<TSource> CacheInDistributedCache<TSource>(
    this IProviderObservable<TSource> observable,
    string key,
    System.TimeSpan absoluteExpirationRelativeToNow)

Cache the received value in IDistributedCache with the given key and the defined distributed cache options factory function. If an entry with the given key is found in the cache, it will be emitted and the previous chain is skipped.

Package: FluentRestBuilder.Caching

public static IProviderObservable<TSource> CacheInDistributedCache<TSource>(
    this IProviderObservable<TSource> observable,
    string key,
    Func<TSource,Microsoft.Extensions.Caching.Distributed.DistributedCacheEntryOptions> optionsFactory)

CacheInMemoryCache

Cache the received value in IMemoryCache with the given key and the defined absolute expiration moment. If an entry with the given key is found in the cache, it will be emitted and the previous chain is skipped.

Package: FluentRestBuilder.Caching

public static IProviderObservable<TSource> CacheInMemoryCache<TSource>(
    this IProviderObservable<TSource> observable,
    object key,
    System.DateTimeOffset absoluteExpiration)

Cache the received value in IMemoryCache with the given key and the defined absolute expiration moment relative to now. If an entry with the given key is found in the cache, it will be emitted and the previous chain is skipped.

Package: FluentRestBuilder.Caching

public static IProviderObservable<TSource> CacheInMemoryCache<TSource>(
    this IProviderObservable<TSource> observable,
    object key,
    System.TimeSpan absoluteExpirationRelativeToNow)

Cache the received value in IMemoryCache with the given key and the given expiration token. If an entry with the given key is found in the cache, it will be emitted and the previous chain is skipped.

Package: FluentRestBuilder.Caching

public static IProviderObservable<TSource> CacheInMemoryCache<TSource>(
    this IProviderObservable<TSource> observable,
    object key,
    Microsoft.Extensions.Primitives.IChangeToken expirationToken)

Cache the received value in IMemoryCache with the given key and the defined memory cache options factory function. If an entry with the given key is found in the cache, it will be emitted and the previous chain is skipped.

Package: FluentRestBuilder.Caching

public static IProviderObservable<TSource> CacheInMemoryCache<TSource>(
    this IProviderObservable<TSource> observable,
    object key,
    Func<TSource,Microsoft.Extensions.Caching.Memory.MemoryCacheEntryOptions> optionsFactory)

Catch

Catch an exception emitted from the previous observables or operators and return a new observable.

Package: FluentRestBuilder

public static IProviderObservable<TSource> Catch<TSource>(
    this IProviderObservable<TSource> observable,
    Func<System.Exception,IProviderObservable<TSource>> handler)

Catch an exception emitted from the previous observables or operators and perform an action with it. This will only catch the exception if it is an instance of the declared exception type.

Package: FluentRestBuilder

public static IProviderObservable<TSource> Catch<TSource, TException>(
    this IProviderObservable<TSource> observable,
    Action<TException> action)

Catch an exception emitted from the previous observables or operators and perform an action with it.

Package: FluentRestBuilder

public static IProviderObservable<TSource> Catch<TSource>(
    this IProviderObservable<TSource> observable,
    Action<System.Exception> action)

Catch an exception emitted from the previous observables or operators and return a new observable. This will only catch the exception if it is an instance of the declared exception type.

Package: FluentRestBuilder

public static IProviderObservable<TSource> Catch<TSource, TException>(
    this IProviderObservable<TSource> observable,
    Func<TException,IProviderObservable<TSource>> handler)

CurrentUserHas

If the check returns false, ValidationException is emitted as an error with the status code 403 (Forbidden). Otherwise the given value is emitted.

Requires usage of HttpContextProviderAttribute.

Package: FluentRestBuilder

public static IProviderObservable<TSource> CurrentUserHas<TSource>(
    this IProviderObservable<TSource> observable,
    Func<System.Security.Claims.ClaimsPrincipal,TSource,System.Boolean> principalCheck,
    object error)

If the check returns false, ValidationException is emitted as an error with the status code 403 (Forbidden). Otherwise the given value is emitted.

Requires usage of HttpContextProviderAttribute.

Package: FluentRestBuilder

public static IProviderObservable<TSource> CurrentUserHas<TSource>(
    this IProviderObservable<TSource> observable,
    Func<System.Security.Claims.ClaimsPrincipal,System.Boolean> principalCheck,
    Func<TSource,object> errorFactory)

If the check returns false, ValidationException is emitted as an error with the status code 403 (Forbidden). Otherwise the given value is emitted.

Requires usage of HttpContextProviderAttribute.

Package: FluentRestBuilder

public static IProviderObservable<TSource> CurrentUserHas<TSource>(
    this IProviderObservable<TSource> observable,
    Func<System.Security.Claims.ClaimsPrincipal,System.Boolean> principalCheck,
    object error)

If the check returns false, ValidationException is emitted as an error with the status code 403 (Forbidden). Otherwise the given value is emitted.

Requires usage of HttpContextProviderAttribute.

Package: FluentRestBuilder

public static IProviderObservable<TSource> CurrentUserHas<TSource>(
    this IProviderObservable<TSource> observable,
    Func<System.Security.Claims.ClaimsPrincipal,TSource,System.Boolean> principalCheck,
    Func<TSource,object> errorFactory)

CurrentUserHasClaim

If the check returns false, ValidationException is emitted as an error with the status code 403 (Forbidden). Otherwise the given value is emitted.

Requires usage of HttpContextProviderAttribute.

Package: FluentRestBuilder

public static IProviderObservable<TSource> CurrentUserHasClaim<TSource>(
    this IProviderObservable<TSource> observable,
    string claimType,
    string claim,
    Func<TSource,object> errorFactory)

If the check returns false, ValidationException is emitted as an error with the status code 403 (Forbidden). Otherwise the given value is emitted.

Requires usage of HttpContextProviderAttribute.

Package: FluentRestBuilder

public static IProviderObservable<TSource> CurrentUserHasClaim<TSource>(
    this IProviderObservable<TSource> observable,
    string claimType,
    string claim,
    object error)

If the check returns false, ValidationException is emitted as an error with the status code 403 (Forbidden). Otherwise the given value is emitted.

Requires usage of HttpContextProviderAttribute.

Package: FluentRestBuilder

public static IProviderObservable<TSource> CurrentUserHasClaim<TSource>(
    this IProviderObservable<TSource> observable,
    string claimType,
    Func<TSource,string> claimFactory,
    Func<TSource,object> errorFactory)

If the check returns false, ValidationException is emitted as an error with the status code 403 (Forbidden). Otherwise the given value is emitted.

Requires usage of HttpContextProviderAttribute.

Package: FluentRestBuilder

public static IProviderObservable<TSource> CurrentUserHasClaim<TSource>(
    this IProviderObservable<TSource> observable,
    string claimType,
    Func<TSource,string> claimFactory,
    object error)

DeleteEntity

Remove the received entity from the DbContext and save the change.

Package: FluentRestBuilder.EntityFrameworkCore

public static IProviderObservable<TSource> DeleteEntity<TSource>(
    this IProviderObservable<TSource> observable)

Do

Perform an action on the received value.

Package: FluentRestBuilder

public static IProviderObservable<TSource> Do<TSource>(
    this IProviderObservable<TSource> observable,
    Action<TSource> action)

DoAsync

Asynchronously perform an action on the received value.

Package: FluentRestBuilder

public static IProviderObservable<TSource> DoAsync<TSource>(
    this IProviderObservable<TSource> observable,
    Func<TSource,System.Threading.Tasks.Task> action)

First

Emits the first element of a sequence.

Package: FluentRestBuilder

public static IProviderObservable<TSource> First<TSource>(
    this IProviderObservable<IQueryable<TSource>> observable)

Emits the first element of a sequence that satisfies a specified condition.

Package: FluentRestBuilder

public static IProviderObservable<TSource> First<TSource>(
    this IProviderObservable<IQueryable<TSource>> observable,
    Expression<Func<TSource,System.Boolean>> predicate)

FirstAsync

Emits the first element of a sequence.

Package: FluentRestBuilder.EntityFrameworkCore

public static IProviderObservable<TSource> FirstAsync<TSource>(
    this IProviderObservable<IQueryable<TSource>> observable)

Emits the first element of a sequence that satisfies a specified condition.

Package: FluentRestBuilder.EntityFrameworkCore

public static IProviderObservable<TSource> FirstAsync<TSource>(
    this IProviderObservable<IQueryable<TSource>> observable,
    Expression<Func<TSource,System.Boolean>> predicate)

FirstOrDefault

Emits the first element of a sequence, or a default value if the sequence contains no elements.

Package: FluentRestBuilder

public static IProviderObservable<TSource> FirstOrDefault<TSource>(
    this IProviderObservable<IQueryable<TSource>> observable)

Emits the first element of a sequence that satisfies a specified condition or a default value if no such element is found.

Package: FluentRestBuilder

public static IProviderObservable<TSource> FirstOrDefault<TSource>(
    this IProviderObservable<IQueryable<TSource>> observable,
    Expression<Func<TSource,System.Boolean>> predicate)

FirstOrDefaultAsync

Emits the first element of a sequence, or a default value if the sequence contains no elements.

Package: FluentRestBuilder.EntityFrameworkCore

public static IProviderObservable<TSource> FirstOrDefaultAsync<TSource>(
    this IProviderObservable<IQueryable<TSource>> observable)

Emits the first element of a sequence that satisfies a specified condition or a default value if no such element is found.

Package: FluentRestBuilder.EntityFrameworkCore

public static IProviderObservable<TSource> FirstOrDefaultAsync<TSource>(
    this IProviderObservable<IQueryable<TSource>> observable,
    Expression<Func<TSource,System.Boolean>> predicate)

ForbiddenWhen

If the check returns true, ValidationException is emitted as an error with the status code 403 (Forbidden). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> ForbiddenWhen<TSource>(
    this IProviderObservable<TSource> observable,
    Func<TSource,System.Boolean> invalidCheck,
    Func<TSource,object> errorFactory)

If the check returns true, ValidationException is emitted as an error with the status code 403 (Forbidden). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> ForbiddenWhen<TSource>(
    this IProviderObservable<TSource> observable,
    Func<TSource,System.Boolean> invalidCheck,
    object error)

If the check returns true, ValidationException is emitted as an error with the status code 403 (Forbidden). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> ForbiddenWhen<TSource>(
    this IProviderObservable<TSource> observable,
    Func<System.Boolean> invalidCheck,
    Func<TSource,object> errorFactory)

If the check returns true, ValidationException is emitted as an error with the status code 403 (Forbidden). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> ForbiddenWhen<TSource>(
    this IProviderObservable<TSource> observable,
    Func<System.Boolean> invalidCheck,
    object error)

ForbiddenWhenAsync

If the check returns true, ValidationException is emitted as an error with the status code 403 (Forbidden). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> ForbiddenWhenAsync<TSource>(
    this IProviderObservable<TSource> observable,
    Func<TSource,Task<System.Boolean>> invalidCheck,
    Func<TSource,object> errorFactory)

If the check returns true, ValidationException is emitted as an error with the status code 403 (Forbidden). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> ForbiddenWhenAsync<TSource>(
    this IProviderObservable<TSource> observable,
    Func<TSource,Task<System.Boolean>> invalidCheck,
    object error)

If the check returns true, ValidationException is emitted as an error with the status code 403 (Forbidden). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> ForbiddenWhenAsync<TSource>(
    this IProviderObservable<TSource> observable,
    Func<Task<System.Boolean>> invalidCheck,
    Func<TSource,object> errorFactory)

If the check returns true, ValidationException is emitted as an error with the status code 403 (Forbidden). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> ForbiddenWhenAsync<TSource>(
    this IProviderObservable<TSource> observable,
    Func<Task<System.Boolean>> invalidCheck,
    object error)

GoneWhen

If the check returns true, ValidationException is emitted as an error with the status code 410 (Gone). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> GoneWhen<TSource>(
    this IProviderObservable<TSource> observable,
    Func<TSource,System.Boolean> invalidCheck,
    Func<TSource,object> errorFactory)

If the check returns true, ValidationException is emitted as an error with the status code 410 (Gone). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> GoneWhen<TSource>(
    this IProviderObservable<TSource> observable,
    Func<TSource,System.Boolean> invalidCheck,
    object error)

If the check returns true, ValidationException is emitted as an error with the status code 410 (Gone). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> GoneWhen<TSource>(
    this IProviderObservable<TSource> observable,
    Func<System.Boolean> invalidCheck,
    Func<TSource,object> errorFactory)

If the check returns true, ValidationException is emitted as an error with the status code 410 (Gone). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> GoneWhen<TSource>(
    this IProviderObservable<TSource> observable,
    Func<System.Boolean> invalidCheck,
    object error)

GoneWhenAsync

If the check returns true, ValidationException is emitted as an error with the status code 410 (Gone). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> GoneWhenAsync<TSource>(
    this IProviderObservable<TSource> observable,
    Func<TSource,Task<System.Boolean>> invalidCheck,
    Func<TSource,object> errorFactory)

If the check returns true, ValidationException is emitted as an error with the status code 410 (Gone). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> GoneWhenAsync<TSource>(
    this IProviderObservable<TSource> observable,
    Func<TSource,Task<System.Boolean>> invalidCheck,
    object error)

If the check returns true, ValidationException is emitted as an error with the status code 410 (Gone). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> GoneWhenAsync<TSource>(
    this IProviderObservable<TSource> observable,
    Func<Task<System.Boolean>> invalidCheck,
    Func<TSource,object> errorFactory)

If the check returns true, ValidationException is emitted as an error with the status code 410 (Gone). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> GoneWhenAsync<TSource>(
    this IProviderObservable<TSource> observable,
    Func<Task<System.Boolean>> invalidCheck,
    object error)

Include

Specifies related entities to include in the query results. The navigation property to be included is specified starting with the type of entity being queried (<typeparamref name=”TSource” />). If you wish to include additional types based on the navigation properties of the type being included, then chain a call to Func{`<TSource>,``2}}) after this call.

Package: FluentRestBuilder.EntityFrameworkCore

public static IProviderObservable<IIncludableQueryable<TSource,TProperty>> Include<TSource, TProperty>(
    this IProviderObservable<IQueryable<TSource>> observable,
    Expression<Func<TSource,TProperty>> navigationPropertyPath)

InsertEntity

Add the received entity from the DbContext and save the change.

Package: FluentRestBuilder.EntityFrameworkCore

public static IProviderObservable<TSource> InsertEntity<TSource>(
    this IProviderObservable<TSource> observable)

InvalidWhen

If the check returns true, ValidationException is emitted as an error with the given status code. Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> InvalidWhen<TSource>(
    this IProviderObservable<TSource> observable,
    Func<TSource,System.Boolean> invalidCheck,
    int statusCode,
    object error)

If the check returns true, ValidationException is emitted as an error with the given status code. Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> InvalidWhen<TSource>(
    this IProviderObservable<TSource> observable,
    Func<System.Boolean> invalidCheck,
    int statusCode,
    Func<TSource,object> errorFactory)

If the check returns true, ValidationException is emitted as an error with the given status code. Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> InvalidWhen<TSource>(
    this IProviderObservable<TSource> observable,
    Func<System.Boolean> invalidCheck,
    int statusCode,
    object error)

If the check returns true, ValidationException is emitted as an error with the given status code. Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> InvalidWhen<TSource>(
    this IProviderObservable<TSource> observable,
    Func<TSource,System.Boolean> invalidCheck,
    int statusCode,
    Func<TSource,object> errorFactory)

InvalidWhenAsync

If the check returns true, ValidationException is emitted as an error with the given status code. Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> InvalidWhenAsync<TSource>(
    this IProviderObservable<TSource> observable,
    Func<TSource,Task<System.Boolean>> invalidCheck,
    int statusCode,
    object error)

If the check returns true, ValidationException is emitted as an error with the given status code. Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> InvalidWhenAsync<TSource>(
    this IProviderObservable<TSource> observable,
    Func<Task<System.Boolean>> invalidCheck,
    int statusCode,
    Func<TSource,object> errorFactory)

If the check returns true, ValidationException is emitted as an error with the given status code. Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> InvalidWhenAsync<TSource>(
    this IProviderObservable<TSource> observable,
    Func<Task<System.Boolean>> invalidCheck,
    int statusCode,
    object error)

If the check returns true, ValidationException is emitted as an error with the given status code. Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> InvalidWhenAsync<TSource>(
    this IProviderObservable<TSource> observable,
    Func<TSource,Task<System.Boolean>> invalidCheck,
    int statusCode,
    Func<TSource,object> errorFactory)

LoadCollection

Load a reference collection from the database.

Package: FluentRestBuilder.EntityFrameworkCore

public static IProviderObservable<TSource> LoadCollection<TSource, TProperty>(
    this IProviderObservable<TSource> observable,
    Expression<Func<TSource,IEnumerable<TProperty>>> propertyExpression)

LoadReference

Load a single reference from the database.

Package: FluentRestBuilder.EntityFrameworkCore

public static IProviderObservable<TSource> LoadReference<TSource, TProperty>(
    this IProviderObservable<TSource> observable,
    Expression<Func<TSource,TProperty>> propertyExpression)

Map

Map the received value to the desired output.

Package: FluentRestBuilder

public static IProviderObservable<TTarget> Map<TSource, TTarget>(
    this IProviderObservable<TSource> observable,
    Func<TSource,TTarget> mapping)

MapAsync

Asynchronously map the received value to the desired output.

Package: FluentRestBuilder

public static IProviderObservable<TTarget> MapAsync<TSource, TTarget>(
    this IProviderObservable<TSource> observable,
    Func<TSource,Task<TTarget>> mapping)

MapToQueryable

Map to a IQueryable<TSource> from the received DbContext. Use the Set`<TSource> method to select the appropriate IQueryable<TSource>.

Package: FluentRestBuilder.EntityFrameworkCore

public static IProviderObservable<IQueryable<TTarget>> MapToQueryable<TSource, TTarget>(
    this IProviderObservable<TSource> observable,
    Func<Microsoft.EntityFrameworkCore.DbContext,IQueryable<TTarget>> mapping)

Map to a IQueryable<TSource> from the received DbContext. Use the Set`<TSource> method to select the appropriate IQueryable<TSource>.

Package: FluentRestBuilder.EntityFrameworkCore

public static IProviderObservable<IQueryable<TTarget>> MapToQueryable<TSource, TTarget>(
    this IProviderObservable<TSource> observable,
    Func<TSource,Microsoft.EntityFrameworkCore.DbContext,IQueryable<TTarget>> mapping)

MapToRestCollection

Maps the entries of the received IEnumerable<TSource> according to the given mapping function and wraps the result in an IRestEntity.

Requires HttpContextProviderAttribute to be set.

Package: FluentRestBuilder.HypertextApplicationLanguage

public static IProviderObservable<FluentRestBuilder.HypertextApplicationLanguage.IRestEntity> MapToRestCollection<TSource, TTarget>(
    this IProviderObservable<IEnumerable<TSource>> observable,
    Func<TSource,TTarget> mapping)

NotFoundWhen

If the check returns true, ValidationException is emitted as an error with the status code 404 (Not Found). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> NotFoundWhen<TSource>(
    this IProviderObservable<TSource> observable,
    Func<TSource,System.Boolean> invalidCheck,
    Func<TSource,object> errorFactory)

If the check returns true, ValidationException is emitted as an error with the status code 404 (Not Found). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> NotFoundWhen<TSource>(
    this IProviderObservable<TSource> observable,
    Func<TSource,System.Boolean> invalidCheck,
    object error)

If the check returns true, ValidationException is emitted as an error with the status code 404 (Not Found). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> NotFoundWhen<TSource>(
    this IProviderObservable<TSource> observable,
    Func<System.Boolean> invalidCheck,
    Func<TSource,object> errorFactory)

If the check returns true, ValidationException is emitted as an error with the status code 404 (Not Found). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> NotFoundWhen<TSource>(
    this IProviderObservable<TSource> observable,
    Func<System.Boolean> invalidCheck,
    object error)

NotFoundWhenAsync

If the check returns true, ValidationException is emitted as an error with the status code 404 (Not Found). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> NotFoundWhenAsync<TSource>(
    this IProviderObservable<TSource> observable,
    Func<TSource,Task<System.Boolean>> invalidCheck,
    Func<TSource,object> errorFactory)

If the check returns true, ValidationException is emitted as an error with the status code 404 (Not Found). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> NotFoundWhenAsync<TSource>(
    this IProviderObservable<TSource> observable,
    Func<TSource,Task<System.Boolean>> invalidCheck,
    object error)

If the check returns true, ValidationException is emitted as an error with the status code 404 (Not Found). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> NotFoundWhenAsync<TSource>(
    this IProviderObservable<TSource> observable,
    Func<Task<System.Boolean>> invalidCheck,
    Func<TSource,object> errorFactory)

If the check returns true, ValidationException is emitted as an error with the status code 404 (Not Found). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> NotFoundWhenAsync<TSource>(
    this IProviderObservable<TSource> observable,
    Func<Task<System.Boolean>> invalidCheck,
    object error)

NotFoundWhenNull

If the received value is null, ValidationException is emitted as an error with the status code 404 (Not Found). Otherwise the given value is emitted.

Package: FluentRestBuilder

public static IProviderObservable<TSource> NotFoundWhenNull<TSource>(
    this IProviderObservable<TSource> observable,
    Func<TSource,object> errorFactory)

OrderBy

Sorts the elements of a sequence in ascending order according to a key.

Package: FluentRestBuilder

public static IProviderObservable<IOrderedQueryable<TSource>> OrderBy<TSource, TKey>(
    this IProviderObservable<IQueryable<TSource>> observable,
    Expression<Func<TSource,TKey>> keySelector)

Sorts the elements of a sequence in ascending order by using a specified comparer.

Package: FluentRestBuilder

public static IProviderObservable<IOrderedQueryable<TSource>> OrderBy<TSource, TKey>(
    this IProviderObservable<IQueryable<TSource>> observable,
    Expression<Func<TSource,TKey>> keySelector,
    IComparer<TKey> comparer)

OrderByDescending

Sorts the elements of a sequence in descending order according to a key.

Package: FluentRestBuilder

public static IProviderObservable<IOrderedQueryable<TSource>> OrderByDescending<TSource, TKey>(
    this IProviderObservable<IQueryable<TSource>> observable,
    Expression<Func<TSource,TKey>> keySelector)

Sorts the elements of a sequence in descending order by using a specified comparer.

Package: FluentRestBuilder

public static IProviderObservable<IOrderedQueryable<TSource>> OrderByDescending<TSource, TKey>(
    this IProviderObservable<IQueryable<TSource>> observable,
    Expression<Func<TSource,TKey>> keySelector,
    IComparer<TKey> comparer)

ReloadEntity

Reloads the entity from the database overwriting any property values with values from the database.

The entity will be in the Unchanged state after calling this method, unless the entity does not exist in the database, in which case the entity will be Detached. Finally, calling Reload on an Added entity that does not exist in the database is a no-op. Note, however, that an Added entity may not yet have had its permanent key value created.

Package: FluentRestBuilder.EntityFrameworkCore

public static IProviderObservable<TSource> ReloadEntity<TSource>(
    this IProviderObservable<TSource> observable)

RemoveDistributedCacheEntry

Remove a cache entry from the IDistributedCache with the key generated by the key factory function.

Package: FluentRestBuilder.Caching

public static IProviderObservable<TSource> RemoveDistributedCacheEntry<TSource>(
    this IProviderObservable<TSource> observable,
    Func<TSource,string> keyFactory)

Remove a cache entry from the IDistributedCache with the key generated by the key factory function.

Package: FluentRestBuilder.Caching

public static IProviderObservable<TSource> RemoveDistributedCacheEntry<TSource>(
    this IProviderObservable<TSource> observable,
    string key)

RemoveMemoryCacheEntry

Remove a cache entry from the IMemoryCache with the key generated by the key factory function.

Package: FluentRestBuilder.Caching

public static IProviderObservable<TSource> RemoveMemoryCacheEntry<TSource>(
    this IProviderObservable<TSource> observable,
    Func<TSource,object> keyFactory)

Remove a cache entry from the IMemoryCache with the given key.

Package: FluentRestBuilder.Caching

public static IProviderObservable<TSource> RemoveMemoryCacheEntry<TSource>(
    this IProviderObservable<TSource> observable,
    object key)

SaveChangesAsync

Save changes to the DbContext asynchronously.

Package: FluentRestBuilder.EntityFrameworkCore

public static IProviderObservable<TSource> SaveChangesAsync<TSource>(
    this IProviderObservable<TSource> observable)

Single

Emits the only element of a sequence, and throws an exception if there is not exactly one element in the sequence.

Package: FluentRestBuilder

public static IProviderObservable<TSource> Single<TSource>(
    this IProviderObservable<IQueryable<TSource>> observable)

Emits the only element of a sequence that satisfies a specified condition, and throws an exception if more than one such element exists.

Package: FluentRestBuilder

public static IProviderObservable<TSource> Single<TSource>(
    this IProviderObservable<IQueryable<TSource>> observable,
    Expression<Func<TSource,System.Boolean>> predicate)

SingleAsync

Emits the only element of a sequence, and throws an exception if there is not exactly one element in the sequence.

Package: FluentRestBuilder.EntityFrameworkCore

public static IProviderObservable<TSource> SingleAsync<TSource>(
    this IProviderObservable<IQueryable<TSource>> observable)

Emits the only element of a sequence that satisfies a specified condition, and throws an exception if more than one such element exists.

Package: FluentRestBuilder.EntityFrameworkCore

public static IProviderObservable<TSource> SingleAsync<TSource>(
    this IProviderObservable<IQueryable<TSource>> observable,
    Expression<Func<TSource,System.Boolean>> predicate)

SingleOrDefault

Emits the only element of a sequence, or a default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence.

Package: FluentRestBuilder

public static IProviderObservable<TSource> SingleOrDefault<TSource>(
    this IProviderObservable<IQueryable<TSource>> observable)

Emits the only element of a sequence that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition.

Package: FluentRestBuilder

public static IProviderObservable<TSource> SingleOrDefault<TSource>(
    this IProviderObservable<IQueryable<TSource>> observable,
    Expression<Func<TSource,System.Boolean>> predicate)

SingleOrDefaultAsync

Emits the only element of a sequence, or a default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence.

Package: FluentRestBuilder.EntityFrameworkCore

public static IProviderObservable<TSource> SingleOrDefaultAsync<TSource>(
    this IProviderObservable<IQueryable<TSource>> observable)

Emits the only element of a sequence that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition.

Package: FluentRestBuilder.EntityFrameworkCore

public static IProviderObservable<TSource> SingleOrDefaultAsync<TSource>(
    this IProviderObservable<IQueryable<TSource>> observable,
    Expression<Func<TSource,System.Boolean>> predicate)

ThenBy

Performs a subsequent ordering of the elements in a sequence in ascending order according to a key.

Package: FluentRestBuilder

public static IProviderObservable<IOrderedQueryable<TSource>> ThenBy<TSource, TKey>(
    this IProviderObservable<IOrderedQueryable<TSource>> observable,
    Expression<Func<TSource,TKey>> keySelector)

Performs a subsequent ordering of the elements in a sequence in ascending order by using a specified comparer.

Package: FluentRestBuilder

public static IProviderObservable<IOrderedQueryable<TSource>> ThenBy<TSource, TKey>(
    this IProviderObservable<IOrderedQueryable<TSource>> observable,
    Expression<Func<TSource,TKey>> keySelector,
    IComparer<TKey> comparer)

ThenByDescending

Performs a subsequent ordering of the elements in a sequence in descending order, according to a key.

Package: FluentRestBuilder

public static IProviderObservable<IOrderedQueryable<TSource>> ThenByDescending<TSource, TKey>(
    this IProviderObservable<IOrderedQueryable<TSource>> observable,
    Expression<Func<TSource,TKey>> keySelector)

Performs a subsequent ordering of the elements in a sequence in descending order by using a specified comparer.

Package: FluentRestBuilder

public static IProviderObservable<IOrderedQueryable<TSource>> ThenByDescending<TSource, TKey>(
    this IProviderObservable<IOrderedQueryable<TSource>> observable,
    Expression<Func<TSource,TKey>> keySelector,
    IComparer<TKey> comparer)

ThenInclude

Specifies additional related data to be further included based on a related type that was just included.

Package: FluentRestBuilder.EntityFrameworkCore

public static IProviderObservable<IIncludableQueryable<TSource,TProperty>> ThenInclude<TSource, TPreviousProperty, TProperty>(
    this IProviderObservable<IIncludableQueryable<TSource,TPreviousProperty>> observable,
    Expression<Func<TPreviousProperty,TProperty>> navigationPropertyPath)

ToAcceptedObjectResult

Wrap the received value in an ObjectResult with status code 202 (Accepted).

Catches ValidationException and converts it to an appropriate IActionResult.

Package: FluentRestBuilder

public static IProviderObservable<Microsoft.AspNetCore.Mvc.IActionResult> ToAcceptedObjectResult<TSource>(
    this IProviderObservable<TSource> observable)

ToActionResult

Convert the received value into an IActionResult.

Catches ValidationException and converts it to an appropriate IActionResult.

Package: FluentRestBuilder

public static IProviderObservable<Microsoft.AspNetCore.Mvc.IActionResult> ToActionResult<TSource>(
    this IProviderObservable<TSource> observable,
    Func<TSource,Microsoft.AspNetCore.Mvc.IActionResult> mapping)

ToCreatedAtRouteResult

Wrap the received value in an CreatedAtRouteResult with status code 201 (Created).

Catches ValidationException and converts it to an appropriate IActionResult.

Package: FluentRestBuilder

public static IProviderObservable<Microsoft.AspNetCore.Mvc.IActionResult> ToCreatedAtRouteResult<TSource>(
    this IProviderObservable<TSource> observable,
    string routeName,
    Func<TSource,object> routeValuesFactory)

Wrap the received value in an CreatedAtRouteResult with status code 201 (Created).

Catches ValidationException and converts it to an appropriate IActionResult.

Package: FluentRestBuilder

public static IProviderObservable<Microsoft.AspNetCore.Mvc.IActionResult> ToCreatedAtRouteResult<TSource>(
    this IProviderObservable<TSource> observable,
    Func<TSource,object> routeValuesFactory)

ToList

Creates and emits a <see cref=”T:System.Collections.Generic.List`1”></see> from an <see cref=”T:System.Collections.Generic.IEnumerable`1”></see>.

Package: FluentRestBuilder

public static IProviderObservable<List<TSource>> ToList<TSource>(
    this IProviderObservable<IEnumerable<TSource>> observable)

ToListAsync

Asynchronously creates a List<TSource> from an IQueryable<TSource> by enumerating it asynchronously.

Package: FluentRestBuilder.EntityFrameworkCore

public static IProviderObservable<List<TSource>> ToListAsync<TSource>(
    this IProviderObservable<IQueryable<TSource>> observable)

ToNoContentResult

Emits NoContentResult on receiving a value. Does not contain the value.

Catches ValidationException and converts it to an appropriate IActionResult.

Package: FluentRestBuilder

public static IProviderObservable<Microsoft.AspNetCore.Mvc.IActionResult> ToNoContentResult<TSource>(
    this IProviderObservable<TSource> observable)

ToOkObjectResult

Wrap the received value in an OkObjectResult.

Catches ValidationException and converts it to an appropriate IActionResult.

Package: FluentRestBuilder

public static IProviderObservable<Microsoft.AspNetCore.Mvc.IActionResult> ToOkObjectResult<TSource>(
    this IProviderObservable<TSource> observable)

ToOptionsResult

Emits an OptionsResult which lists the allowed HTTP verbs.

Catches ValidationException and converts it to an appropriate IActionResult.

Package: FluentRestBuilder

public static IProviderObservable<Microsoft.AspNetCore.Mvc.IActionResult> ToOptionsResult<TSource>(
    this IProviderObservable<TSource> observable,
    Func<TSource,IEnumerable<FluentRestBuilder.HttpVerb>> verbsFactory)

Emits an OptionsResult which lists the allowed HTTP verbs.

Catches ValidationException and converts it to an appropriate IActionResult.

Requires usage of HttpContextProviderAttribute.

Package: FluentRestBuilder

public static IProviderObservable<Microsoft.AspNetCore.Mvc.IActionResult> ToOptionsResult<TSource>(
    this IProviderObservable<TSource> observable,
    Func<AllowedOptionsBuilder<TSource>,AllowedOptionsBuilder<TSource>> factory)

Where

Filters a sequence of values based on a predicate.

Package: FluentRestBuilder

public static IProviderObservable<IQueryable<TSource>> Where<TSource>(
    this IProviderObservable<IQueryable<TSource>> observable,
    Expression<Func<TSource,System.Boolean>> predicate)

Filters a sequence of values based on a predicate. Each element’s index is used in the logic of the predicate function.

Package: FluentRestBuilder

public static IProviderObservable<IQueryable<TSource>> Where<TSource>(
    this IProviderObservable<IQueryable<TSource>> observable,
    Expression<Func<TSource,int,System.Boolean>> predicate)

WithDbContext

Perform an action with the DbContext.

Package: FluentRestBuilder.EntityFrameworkCore

public static IProviderObservable<TSource> WithDbContext<TSource>(
    this IProviderObservable<TSource> observable,
    Action<TSource,Microsoft.EntityFrameworkCore.DbContext> action)

WithDbContextAsync

Perform an async action with the DbContext.

Package: FluentRestBuilder.EntityFrameworkCore

public static IProviderObservable<TSource> WithDbContextAsync<TSource>(
    this IProviderObservable<TSource> observable,
    Func<TSource,Microsoft.EntityFrameworkCore.DbContext,System.Threading.Tasks.Task> action)

WithEntityEntry

Perform an action with the EntityEntry<TSource> of the received value.

Package: FluentRestBuilder.EntityFrameworkCore

public static IProviderObservable<TSource> WithEntityEntry<TSource>(
    this IProviderObservable<TSource> observable,
    Action<EntityEntry<TSource>> action)

WithEntityEntryAsync

Perform an async action with the EntityEntry<TSource> of the received value.

Package: FluentRestBuilder.EntityFrameworkCore

public static IProviderObservable<TSource> WithEntityEntryAsync<TSource>(
    this IProviderObservable<TSource> observable,
    Func<EntityEntry<TSource>,System.Threading.Tasks.Task> action)