{"id":22797986,"url":"https://github.com/6bee/aqua-accesscontrol","last_synced_at":"2025-10-25T05:09:23.581Z","repository":{"id":99412268,"uuid":"121802877","full_name":"6bee/aqua-accesscontrol","owner":"6bee","description":"Query filters for linq expressions","archived":false,"fork":false,"pushed_at":"2024-07-10T12:48:32.000Z","size":135,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-07T22:51:41.568Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/6bee.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-16T21:31:00.000Z","updated_at":"2024-07-10T12:49:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"e3bd24ce-3931-4865-8dba-86100c23e6af","html_url":"https://github.com/6bee/aqua-accesscontrol","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/6bee/aqua-accesscontrol","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/6bee%2Faqua-accesscontrol","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/6bee%2Faqua-accesscontrol/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/6bee%2Faqua-accesscontrol/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/6bee%2Faqua-accesscontrol/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/6bee","download_url":"https://codeload.github.com/6bee/aqua-accesscontrol/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/6bee%2Faqua-accesscontrol/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270940594,"owners_count":24671676,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-12T06:07:50.613Z","updated_at":"2025-10-25T05:09:23.532Z","avatar_url":"https://github.com/6bee.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# aqua-accesscontrol\n\n[![GitHub license][lic-badge]][lic-link]\n[![Github Workflow][pub-badge]][pub-link]\n\n| branch | AppVeyor                | Travis CI                      |\n| ---    | ---                     | ---                            |\n| `main` | [![Build status][5]][6] | [![Travis build Status][7]][8] |\n\n| package              | nuget                  | myget                        |\n| ---                  | ---                    | ---                          |\n| `aqua-accesscontrol` | [![NuGet Badge][1]][2] | [![MyGet Pre Release][3]][4] |\n\n## Description\n\nThis C# library provides extension methods for [System.Linq.IQueryable\u003c\u003e](https://learn.microsoft.com/en-us/dotnet/api/system.linq.iqueryable) and [System.Linq.Expressions.Expression](https://learn.microsoft.com/en-us/dotnet/api/system.linq.expressions.expression) types, to apply query filters at various levels.\n\n## Features\n\n### Global Predicate\n\nGlobal predicates apply to a query as a whole and must be satisfied for any results be returned.\n\nPredicates can be based on progam logic and/or on expanded data query:\n\n```C#\n// base query\nvar query =\n    from p in repo.Products\n    select p;\n// code based predicate\nvar result1 = query\n    .Apply(Predicate.Create(() =\u003e true))\n    .ToList();\n// predicate based on data qeury\nvar result2 = query\n    .Apply(Predicate.Create(() =\u003e\n        repo.Claims.Any(c =\u003e\n            c.Type == ClaimTypes.Tenant \u0026\u0026\n            c.Value == \"1\" \u0026\u0026\n            c.Subject == username)))\n    .ToList();\n```\n\n### Type Predicate\n\nType predicates apply to specific record types within a query by filtering out corresponding records that do not satisfy the condition.\n\nThe following predicate filters out records which have not `TenantId` equal to 1:\n\n```C#\nvar query =\n    from o in repo.Orders\n    select new { o.Id };\nvar result = query\n    .Apply(Predicate.Create\u003cOrder\u003e(o =\u003e o.TenantId == 1))\n    .ToList();\n```\n\n### Property Predicate\n\nProperty predicates do not filter out records but allow property values to be returned only when specified conditions are satisfied.\n\nThe 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:\n\n```C#\nvar query =\n    from p in repo.Products\n    select new { p.Id, p.Price };\nvar result = query\n    .Apply(Predicate.Create\u003cProduct, decimal\u003e(\n        p =\u003e p.Price,\n        p =\u003e p.TenantId == 1))\n    .ToList();\n```\n\n### Property Projection Predicate\n\nProperty projection predicates allow to project values of a certain property based on custom logic.\n\nIn the following example, a 10% discount is applied if `TenantId` is equal to 1:\n\n```C#\nvar query =\n    from p in repo.Products\n    select new { p.Id, p.Price };\n\nvar result = query\n    .Apply(Predicate.CreatePropertyProjection\u003cProduct, decimal\u003e(\n        p =\u003e p.Price,\n        p =\u003e p.TenantId == 1 ? p.Price * 0.9m : p.Price))\n    .ToList();\n```\n\n[1]: https://buildstats.info/nuget/aqua-accesscontrol?includePreReleases=true\n[2]: http://www.nuget.org/packages/aqua-accesscontrol\n[3]: http://img.shields.io/myget/aqua/vpre/aqua-accesscontrol.svg?style=flat-square\u0026label=myget\n[4]: https://www.myget.org/feed/aqua/package/nuget/aqua-accesscontrol\n[5]: https://ci.appveyor.com/api/projects/status/se738mykuhel4b3q/branch/main?svg=true\n[6]: https://ci.appveyor.com/project/6bee/aqua-accesscontrol/branch/main\n[7]: https://travis-ci.org/6bee/aqua-accesscontrol.svg?branch=main\n[8]: https://travis-ci.org/6bee/aqua-accesscontrol?branch=main\n\n[lic-badge]: https://img.shields.io/github/license/6bee/aqua-accesscontrol.svg\n[lic-link]: https://github.com/6bee/aqua-accesscontrol/blob/main/license.txt\n\n[pub-badge]: https://github.com/6bee/aqua-accesscontrol/actions/workflows/publish.yml/badge.svg\n[pub-link]: https://github.com/6bee/aqua-accesscontrol/actions/workflows/publish.yml\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F6bee%2Faqua-accesscontrol","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F6bee%2Faqua-accesscontrol","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F6bee%2Faqua-accesscontrol/lists"}