{"id":29540664,"url":"https://github.com/estuardodev/netdataquery","last_synced_at":"2026-05-15T12:34:03.527Z","repository":{"id":304038186,"uuid":"998940522","full_name":"estuardodev/NetDataQuery","owner":"estuardodev","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-10T20:45:27.000Z","size":148,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-17T09:36:18.858Z","etag":null,"topics":["csharp","dotnet","netcore"],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/NetDataQuery","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/estuardodev.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-09T13:48:40.000Z","updated_at":"2025-07-11T21:06:16.000Z","dependencies_parsed_at":"2025-07-11T01:36:48.196Z","dependency_job_id":"75dc03c4-057e-4821-b023-160d65665a47","html_url":"https://github.com/estuardodev/NetDataQuery","commit_stats":null,"previous_names":["estuardodev/netdataquery"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/estuardodev/NetDataQuery","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estuardodev%2FNetDataQuery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estuardodev%2FNetDataQuery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estuardodev%2FNetDataQuery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estuardodev%2FNetDataQuery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/estuardodev","download_url":"https://codeload.github.com/estuardodev/NetDataQuery/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estuardodev%2FNetDataQuery/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33067359,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T11:35:32.926Z","status":"ssl_error","status_checked_at":"2026-05-15T11:35:31.362Z","response_time":103,"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":["csharp","dotnet","netcore"],"created_at":"2025-07-17T08:05:57.163Z","updated_at":"2026-05-15T12:34:03.491Z","avatar_url":"https://github.com/estuardodev.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NetDataQuery\n\nNetDataQuery is an open-source library for .NET that allows dynamic queries to be defined through method names, simplifying data access without writing LINQ expressions manually.\n\n---\n\n## Installation\n\nInstall the library from NuGet:\n\n```bash\nInstall-Package NetDataQuery\n```\n\nAnd in your `Program.cs`, register the repositories:\n\n```csharp\nbuilder.Services.AddNetDataRepositories\u003cYourDbContext\u003e();\n```\n\n---\n\n## How it works\n\nDefine an interface that inherits from `INetDataQuery\u003cT\u003e` and declare your query methods using `GetBy...`, `FindBy...`, `ReadBy...`, or `QueryBy...`.\n\nThe library parses the method name and automatically generates the corresponding LINQ expression.\n\n---\n\n## Usage Example\n\nAssuming the class `Line`:\n\n```csharp\npublic class Line\n{\n    public int Id { get; set; }\n    public string Name { get; set; } = string.Empty;\n    public bool Active { get; set; }\n    public int BrandId { get; set; }\n    public Brand? Brand { get; set; }\n}\n\npublic class Brand\n{\n    public int Id { get; set; }\n    public string Name { get; set; } = string.Empty;\n    public string? IconColor { get; set; }\n    public bool Active { get; set; }\n}\n```\n\n### Define a repository\n\n```csharp\npublic interface ILineRepository : INetDataQuery\u003cLine\u003e\n{\n    Task\u003cList\u003cLine\u003e\u003e GetByActiveTrue();\n    Task\u003cList\u003cLine\u003e\u003e GetByNameEquals(string name);\n    Task\u003cList\u003cLine\u003e\u003e GetByNameAndActiveFalse(string name);\n    Task\u003cList\u003cLine\u003e\u003e GetByBrandName(string name);\n    Task\u003cList\u003cLine\u003e\u003e GetByBrandIconColorAndActiveTrueIncludeBrand(string color);\n    Task\u003cList\u003cLine\u003e\u003e GetAllIncludeBrand();\n    Task\u003cLine\u003e GetByIdEquals(int id); // Example of Task\u003cClass\u003e\n}\n```\n\n### Use the repository\n\n```csharp\nvar activeLines = await _lineRepository.GetByActiveTrue();\nvar byName = await _lineRepository.GetByNameEquals(\"Special\");\nvar byBrand = await _lineRepository.GetByBrandName(\"Toyota\");\nvar withInclude = await _lineRepository.GetByBrandIconColorAndActiveTrueIncludeBrand(\"red\");\n```\n\n---\n\n## Supported Conventions\n\n### Method types\n\n- `GetBy`, `FindBy`, `ReadBy`, `QueryBy`\n- `GetAll`, `FindAll`, etc.\n\n### Supported Conditions\n\n| Suffix         | Example                            | Generated LINQ Expression            |\n|----------------|------------------------------------|--------------------------------------|\n| Equals (default) | `GetByName(string)`              | `x =\u003e x.Name == value`             |\n| True           | `GetByActiveTrue()`               | `x =\u003e x.Active == true`       |\n| False          | `GetByActiveFalse()`              | `x =\u003e x.Active == false`             |\n| GreaterThan    | `GetByIdGreaterThan(int id)`       | `x =\u003e x.Id \u003e id`                     |\n| LessThan       | `GetByIdLessThan(int id)`          | `x =\u003e x.Id \u003c id`                     |\n\nYou can combine conditions using `And` and `Or`:\n\n```csharp\nGetByNameAndActiveTrue\nGetByIdGreaterThanOrActiveFalse\n```\n\n### Nested relationships\n\nYou can query nested properties of related entities:\n\n```csharp\nGetByBrandName(string name)\nGetByBrandIconColor(string color)\n```\n\n### Includes\n\nTo include relationships, append `Include{Property}` at the end:\n\n```csharp\nGetByBrandNameIncludeBrand\nGetAllIncludeBrand\nGetByActiveTrueIncludeBrand\n```\n\n**Important:** `Include` statements must appear **at the end** of the method name.\n\n---\n\n## Roadmap (future)\n\n- Support for `ThenInclude`\n- Automatic interface and controller generation (scaffolding-style)\n- Sorting (`OrderBy`, `OrderByDesc`)\n- Collection queries (`In`, `Contains`)\n\n---\n\n## Contributions\n\nThis project is open-source. You can create issues, PRs, or suggest improvements. Contributions are welcome!\n\n---\n\n## License\n\nThis project is under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Festuardodev%2Fnetdataquery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Festuardodev%2Fnetdataquery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Festuardodev%2Fnetdataquery/lists"}