aqua-accesscontrol 1.0.0-beta-001

This is a prerelease version of aqua-accesscontrol.
dotnet add package aqua-accesscontrol --version 1.0.0-beta-001                
NuGet\Install-Package aqua-accesscontrol -Version 1.0.0-beta-001                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="aqua-accesscontrol" Version="1.0.0-beta-001" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add aqua-accesscontrol --version 1.0.0-beta-001                
#r "nuget: aqua-accesscontrol, 1.0.0-beta-001"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install aqua-accesscontrol as a Cake Addin
#addin nuget:?package=aqua-accesscontrol&version=1.0.0-beta-001&prerelease

// Install aqua-accesscontrol as a Cake Tool
#tool nuget:?package=aqua-accesscontrol&version=1.0.0-beta-001&prerelease                

About

This package provides extension methods for System.Linq.IQueryable<> and System.Linq.Expressions.Expression types, to apply query filters at various levels.

Features

Global Predicate

Global predicates apply to a query as a whole and must be satisfied for any results be returned.

Predicates can be based on progam logic and/or on expanded data query:

// base query
var query =
    from p in repo.Products
    select p;
// code based predicate
var result1 = query
    .Apply(Predicate.Create(() => true))
    .ToList();
// predicate based on data qeury
var result2 = query
    .Apply(Predicate.Create(() =>
        repo.Claims.Any(c =>
            c.Type == ClaimTypes.Tenant &&
            c.Value == "1" &&
            c.Subject == username)))
    .ToList();

Type Predicate

Type predicates apply to specific record types within a query by filtering out corresponding records that do not satisfy the condition.

The following predicate filters out records which have not TenantId equal to 1:

var query =
    from o in repo.Orders
    select new { o.Id };
var result = query
    .Apply(Predicate.Create<Order>(o => o.TenantId == 1))
    .ToList();

Property Predicate

Property predicates do not filter out records but allow property values to be returned only when specified conditions are satisfied.

The following predicate retrieves product prices only for records which have TenantId equal to 1, other records have the Price property set to its default vaule:

var query =
    from p in repo.Products
    select new { p.Id, p.Price };
var result = query
    .Apply(Predicate.Create<Product, decimal>(p => p.Price, p => p.TenantId == 1))
    .ToList();

Property Projection Predicate

Property projection predicates allow to project values of a certain property based on custom logic.

In the following example, a 10% discount is applied if TenantId is equal to 1:

var query =
    from p in repo.Products
    select new { p.Id, p.Price };

var result = query
    .Apply(Predicate.CreatePropertyProjection<Product, decimal>(
        p => p.Price,
        p => p.TenantId == 1 ? p.Price * 0.9m : p.Price))
    .ToList();
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0-beta-001 55 6/14/2024
0.1.0-alpha-004 55 6/11/2024
0.1.0-alpha-003 50 6/11/2024
0.1.0-alpha-002 967 2/23/2018
0.1.0-alpha-001 752 2/16/2018