{"id":37056419,"url":"https://github.com/mteinum/efext","last_synced_at":"2026-01-14T06:22:25.593Z","repository":{"id":8117029,"uuid":"9533288","full_name":"mteinum/efext","owner":"mteinum","description":"Entity Framework Extensions","archived":false,"fork":false,"pushed_at":"2013-05-08T20:03:02.000Z","size":400,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-18T07:05:01.976Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mteinum.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-04-18T22:28:21.000Z","updated_at":"2022-03-18T12:46:03.000Z","dependencies_parsed_at":"2022-09-08T06:20:35.156Z","dependency_job_id":null,"html_url":"https://github.com/mteinum/efext","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mteinum/efext","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mteinum%2Fefext","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mteinum%2Fefext/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mteinum%2Fefext/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mteinum%2Fefext/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mteinum","download_url":"https://codeload.github.com/mteinum/efext/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mteinum%2Fefext/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28412209,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T05:26:33.345Z","status":"ssl_error","status_checked_at":"2026-01-14T05:21:57.251Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2026-01-14T06:22:24.895Z","updated_at":"2026-01-14T06:22:25.588Z","avatar_url":"https://github.com/mteinum.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"efext\r\n=====\r\n\r\nEntity Framework Extensions\r\n\r\n.NET library with utility extensions for between operations.\r\n\r\n### Installation\r\n\r\nInstall the package from nuget\r\n\r\nhttps://nuget.org/packages/efext/\r\n\r\nand add the using directive\r\n\r\n```c#\r\nusing EfExt;\r\n```\r\n### GreaterThan\r\n\r\n```c#\r\npublic static IQueryable\u003cTSource\u003e GreaterThan\u003cTSource\u003e(\r\n            this IQueryable\u003cTSource\u003e source,\r\n            Expression\u003cFunc\u003cTSource, string\u003e\u003e keySelector,\r\n            string value)\r\n```\r\n\r\nReturns a subset where a given string column is greater than the given argument\r\n\r\n### GreaterThanOrEqual\r\n\r\nSame as GreaterThan but inclusive\r\n\r\n### LessThan\r\n\r\nOpposite of GreaterThan\r\n\r\n### LessThanOrEqual\r\n\r\nOpposite of GreaterThanOrEqual\r\n\r\n### Between\r\n\r\nBetween is the composite of GreaterThanOrEqual and LessThanOrEqual\r\n\r\nThere are two overloads for the Between method\r\n\r\n1. Find rows where a single column is between two strings\r\n\r\n```c#\r\nvar subset = ctx.Numbers.Between(i =\u003e i.Number, \"40401002\", \"40401004\");\r\n```\r\n\r\nalternative\r\n\r\n```c#\r\nvar subset = ctx.Numbers.Between(\"40401002\", i =\u003e i.Number, \"40401004\");\r\n```\r\n\r\n2. Find rows where a string is between two columns\r\n\r\n```c#\r\nvar plan = ctx.NumberPlans.Between(\r\n                    r =\u003e r.LowerNumber,\r\n                    r =\u003e r.UpperNumber,\r\n                    \"40410003\");\r\n```\r\n\r\nalternative\r\n\r\n```c#\r\nvar plan = ctx.NumberPlans.Between(\r\n                    r =\u003e r.LowerNumber,\r\n                    \"40410003\",\r\n                    r =\u003e r.UpperNumber);\r\n```\r\n\r\nLinq\r\n----\r\n\r\n### Recursive\r\n\r\n```c#\r\n        public static IEnumerable\u003cT\u003e Recursive\u003cT\u003e(\r\n            this T node, Func\u003cT, IEnumerable\u003cT\u003e\u003e selector)\r\n```\r\n\r\nThis method can be used for traversing a tree structure. It will extend the node type, and the provided\r\nselector is used for finding the children, that must be of the same type as node (T).\r\n\r\n#### Example\r\n\r\n```c#\r\n        [Test]\r\n        public void NodeWithoutChildren()\r\n        {\r\n            var noChildren = _tree.Recursive(n =\u003e n.Children)\r\n                                  .Where(n =\u003e n.Children.Empty());\r\n\r\n            Assert.AreEqual(4, noChildren.Count());\r\n        }\r\n```\r\n\r\nHow to sort a id/parent object by it's hierarchy\r\n\r\n```c#\r\n[Test]\r\npublic void WithLookupFunction()\r\n{\r\n\tvar items = new[]\r\n\t{\r\n\t\tnew Item(2, 1),\r\n\t\tnew Item(3, 1),\r\n\t\tnew Item(4, 2),\r\n\t\tnew Item(1, 1),\r\n\t\tnew Item(5, 1),\r\n\t\tnew Item(6, 4)\r\n\t};\r\n\r\n\tvar root = items.Single(x =\u003e x.Id == 1);\r\n\r\n\tvar sortedByTree = root.Recursive(items.ChildSelector).ToList();\r\n\r\n\tvar expected = new[] { 1, 2, 4, 6, 3, 5 };\r\n\r\n\tAssert.IsTrue(expected.SequenceEqual(sortedByTree.Select(i =\u003e i.Id)));\r\n}\r\n\r\npublic class Item\r\n{\r\n\tpublic int Id;\r\n\tpublic int Parent;\r\n\r\n\tpublic Item() { }\r\n\tpublic Item(int id, int parent)\r\n\t{\r\n\t\tId = id;\r\n\t\tParent = parent;\r\n\t}\r\n}\r\n\r\npublic static class ItemExt\r\n{\r\n\tpublic static IEnumerable\u003cItem\u003e ChildSelector(\r\n\t\tthis IEnumerable\u003cItem\u003e source,\r\n\t\tItem item)\r\n\t{\r\n\t\treturn source.Where(i =\u003e i.Parent == item.Id \u0026\u0026 i.Parent != i.Id);\r\n\t}\r\n}\r\n```\r\n\r\nSee the testproject for more examples.\r\n\r\nhttps://twitter.com/mteinum\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmteinum%2Fefext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmteinum%2Fefext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmteinum%2Fefext/lists"}