{"id":23773858,"url":"https://github.com/styrainc/ucast-linq","last_synced_at":"2025-07-12T15:11:54.287Z","repository":{"id":267847433,"uuid":"901015444","full_name":"StyraInc/ucast-linq","owner":"StyraInc","description":"UCAST integration for LINQ.","archived":false,"fork":false,"pushed_at":"2025-05-20T18:08:26.000Z","size":80,"stargazers_count":1,"open_issues_count":5,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-06-02T08:27:43.098Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StyraInc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2024-12-09T22:14:46.000Z","updated_at":"2025-04-25T18:31:39.000Z","dependencies_parsed_at":"2024-12-12T20:31:50.475Z","dependency_job_id":"cf79ce2b-3a5d-40ee-8c28-dd5a5bcf5fbd","html_url":"https://github.com/StyraInc/ucast-linq","commit_stats":null,"previous_names":["styrainc/ucast-linq"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/StyraInc/ucast-linq","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StyraInc%2Fucast-linq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StyraInc%2Fucast-linq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StyraInc%2Fucast-linq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StyraInc%2Fucast-linq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StyraInc","download_url":"https://codeload.github.com/StyraInc/ucast-linq/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StyraInc%2Fucast-linq/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265009249,"owners_count":23697157,"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","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":"2025-01-01T05:46:05.051Z","updated_at":"2025-07-12T15:11:54.234Z","avatar_url":"https://github.com/StyraInc.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Styra UCAST integration for LINQ\n\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![NuGet Version](https://img.shields.io/nuget/v/Styra.Ucast.Linq?style=flat\u0026color=%2324b6e0)](https://www.nuget.org/packages/Styra.Ucast.Linq/)\n\n\u003e [!IMPORTANT]\n\u003e The reference documentation for this library is available at https://styrainc.github.io/ucast-linq\n\n\n## Installation\n\n### Nuget\n\n```bash\ndotnet add package Styra.Ucast.Linq\n```\n\n\n## Example Usage\n\nLet's assume that we have a collection of random integers, and wish to filter them with a LINQ query using multiple criteria:\n```csharp\nusing System;\nusing System.Linq;\n\npublic record SimpleRecord(int Value);\n\nvar numbers = new int[] { -1523, 1894, -456, 789, -1002, 345, -1789, 567, 1234, -890, 123, -1456, 1678, -234, 567, -1890, 901, -345, 1567, -789 };\nvar collection = numbers.Select(n =\u003e new SimpleRecord(n)).ToList();\nvar results = collection.Where(x =\u003e x.Value \u003e= 1500 || (x.Value \u003c 400 \u0026\u0026 (x.Value \u003e 0 || x.Value \u003c -1500)))\n                        .OrderBy(x =\u003e x.Value)\n                        .ToList();\n\nConsole.WriteLine(string.Join(\"\\n\", results));\n```\n\n\u003cdetails\u003e\n\n\u003csummary\u003eOutput\u003c/summary\u003e\n\n```csharp\nSimpleRecord { Value = -1890 }\nSimpleRecord { Value = -1789 }\nSimpleRecord { Value = -1523 }\nSimpleRecord { Value = 123 }\nSimpleRecord { Value = 345 }\nSimpleRecord { Value = 1567 }\nSimpleRecord { Value = 1678 }\nSimpleRecord { Value = 1894 }\n```\n\n\u003c/details\u003e\n\nUsing this library, the same filters can be constructed dynamically using UCAST expressions (which can be deserialized from JSON):\n```csharp\nusing System;\nusing System.Linq;\nusing Styra.Ucast.Linq;\n\npublic record SimpleRecord(int Value);\n\nvar conditions = new UCASTNode { Type = \"compound\", Op = \"or\", Value = new List\u003cUCASTNode\u003e{\n    new UCASTNode { Type = \"field\", Op = \"ge\", Field = \"r.value\", Value = 1500 },\n    new UCASTNode { Type = \"compound\", Op = \"and\", Value = new List\u003cUCASTNode\u003e{\n        new UCASTNode { Type = \"field\", Op = \"lt\", Field = \"r.value\", Value = 400 },\n        new UCASTNode { Type = \"compound\", Op = \"or\", Value = new List\u003cUCASTNode\u003e{\n            new UCASTNode { Type = \"field\", Op = \"gt\", Field = \"r.value\", Value = 0 },\n            new UCASTNode { Type = \"field\", Op = \"lt\", Field = \"r.value\", Value = -1500 },\n        } },\n    } },\n} };\n\nvar numbers = new int[] { -1523, 1894, -456, 789, -1002, 345, -1789, 567, 1234, -890, 123, -1456, 1678, -234, 567, -1890, 901, -345, 1567, -789 };\nvar collection = numbers.Select(n =\u003e new SimpleRecord(n)).ToList();\nvar results = collection.AsQueryable()\n                        .ApplyUCASTFilter(conditions, QueryableExtensions.BuildDefaultMapperDictionary\u003cSimpleRecord\u003e(\"r\"))\n                        .OrderBy(x =\u003e x.Value)\n                        .ToList();\n\nConsole.WriteLine(string.Join(\"\\n\", results));\n```\n\n\u003cdetails\u003e\n\n\u003csummary\u003eOutput\u003c/summary\u003e\n\n```csharp\nSimpleRecord { Value = -1890 }\nSimpleRecord { Value = -1789 }\nSimpleRecord { Value = -1523 }\nSimpleRecord { Value = 123 }\nSimpleRecord { Value = 345 }\nSimpleRecord { Value = 1567 }\nSimpleRecord { Value = 1678 }\nSimpleRecord { Value = 1894 }\n```\n\n\u003c/details\u003e\n\n\n## Community\n\nFor questions, discussions and announcements related to Styra products, services and open source projects, please join\nthe Styra community on [Slack](https://communityinviter.com/apps/styracommunity/signup)!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstyrainc%2Fucast-linq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstyrainc%2Fucast-linq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstyrainc%2Fucast-linq/lists"}