{"id":20545852,"url":"https://github.com/xin9le/qlimitive","last_synced_at":"2025-08-21T01:10:15.465Z","repository":{"id":38000119,"uuid":"437917044","full_name":"xin9le/QLimitive","owner":"xin9le","description":"An attribute-based primitive SQL generator that respects Entity Framework Core.","archived":false,"fork":false,"pushed_at":"2024-04-07T08:56:16.000Z","size":99,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-01T00:59:41.482Z","etag":null,"topics":["attribute-based","entity-framework-core","generator","sql"],"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/xin9le.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2021-12-13T15:03:34.000Z","updated_at":"2025-06-25T07:40:26.000Z","dependencies_parsed_at":"2025-04-15T23:31:19.292Z","dependency_job_id":null,"html_url":"https://github.com/xin9le/QLimitive","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/xin9le/QLimitive","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xin9le%2FQLimitive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xin9le%2FQLimitive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xin9le%2FQLimitive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xin9le%2FQLimitive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xin9le","download_url":"https://codeload.github.com/xin9le/QLimitive/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xin9le%2FQLimitive/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271411190,"owners_count":24754871,"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-20T02:00:09.606Z","response_time":69,"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":["attribute-based","entity-framework-core","generator","sql"],"created_at":"2024-11-16T01:53:33.240Z","updated_at":"2025-08-21T01:10:15.440Z","avatar_url":"https://github.com/xin9le.png","language":"C#","readme":"# QLimitive\n\n**QLimitive** is an attribute-based primitive SQL generator that respects the Entity Framework Core and is called '*Primitive*'.\n\n\n[![Releases](https://img.shields.io/github/release/xin9le/QLimitive.svg)](https://github.com/xin9le/QLimitive/releases)\n[![GitHub license](https://img.shields.io/github/license/xin9le/QLimitive)](https://github.com/xin9le/QLimitive/blob/master/LICENSE)\n[![Build and Test](https://github.com/xin9le/QLimitive/actions/workflows/test.yml/badge.svg)](https://github.com/xin9le/QLimitive/actions/workflows/test.yml)\n\n\n## Support Platform\n\n- .NET 6.0+\n\n\n\n## Attribute-based O/R mapping information\n\n**QLimitive** performs O/R mapping and generates SQL based on the attributes used in Entity Framework Core.\n\n\n```cs\nusing System;\nusing System.ComponentModel;\nusing System.ComponentModel.DataAnnotations;\nusing System.ComponentModel.DataAnnotations.Schema;\n\nnamespace SampleApp;\n\n[Table(\"T_People\", Schema = \"dbo\")]\npublic sealed class Person\n{\n    [Key]\n    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]\n    public int Id { get; init; }\n\n    [Column(\"姓\")]\n    public string LastName { get; init; }\n\n    [Column(\"名\")]\n    public string FirstName { get; init; }\n\n    [NotMapped]\n    public string FullName =\u003e $\"{this.LastName} {this.FirstName}\";\n\n    public int Age { get; init; }\n\n    public bool HasChildren { get; init; }\n\n    [AmbientValue(\"SYSDATETIME()\")]\n    public DateTimeOffset CreatedAt { get; init; }\n\n    [Column(\"UpdatedAt\")]\n    [AmbientValue(\"SYSDATETIME()\")]\n    public DateTimeOffset ModifiedAt { get; init; }\n}\n```\n\n\n\n## SQL generation\n\nThis library also provides automatic sql generation feature using above meta data. You can get very simple and typical SQL via `QueryBuilder` class. Of course it's completely type-safe.\n\n```cs\n// Query records with specified columns that matched specified condition\nvar sql = QueryBuilder.Select\u003cPerson\u003e(DbDialect.SqlServer, x =\u003e new { x.LastName, x.Age }).Text;\n\n/*\nselect\n    [姓] as [LastName],\n    [Age] as [Age]\nfrom [dbo].[T_People]\n*/\n```\n\n\n```cs\n// If wants Where / OrderBy / ThenBy, allows you to write like following\nusing (var builder = new QueryBuilder\u003cPerson\u003e(DbDialect.SqlServer))\n{\n    builder.Select(static x =\u003e new { x.Id, x.LastName });\n    builder.Where(static x =\u003e x.LastName == \"Suzuki\");\n    builder.OrderByDescending(static x =\u003e x.Age);\n    builder.ThenBy(static x =\u003e x.ModifiedAt);\n    var sql = builder.Build().Text;\n}\n\n/*\nselect\n    [Id] as [Id],\n    [姓] as [Name]\nfrom [dbo].[T_People]\nwhere\n    [姓] = @p1\norder by\n    [Age] desc,\n    [UpdatedAt]\n*/\n```\n\n```cs\n// Insert record to SQL Server\nvar sql = QueryBuilder.Insert\u003cPerson\u003e(DbDialect.SqlServer, useAmbientValue: true).Text;\n\n/*\ninsert into [dbo].[T_People]\n(\n    [姓],\n    [名],\n    [Age],\n    [HasChildren],\n    [CreatedAt],\n    [UpdatedOn]\n)\nvalues\n(\n    @LastName,\n    @FirstName,\n    @Age,\n    @HasChildren,\n    SYSDATETIME(),\n    SYSDATETIME()\n)\n*/\n```\n\n```cs\n// Update records with specified columns that matched specified condition\nusing (var builder = new QueryBuilder\u003cPerson\u003e(DbDialect.SqlServer))\n{\n    builder.Update(static x =\u003e new { x.LastName, x.Age, x.ModifiedAt }, useAmbientValue: true);\n    builder.Where(static x =\u003e x.Age \u003c 35 || x.LastName == \"Suzuki\");\n    var sql = builder.Build().Text;\n}\n\n/*\nupdate [dbo].[T_People]\nset\n    [姓] = @LastName,\n    [Age] = @Age,\n    [UpdatedAt] = SYSDATETIME()\nwhere\n    [Age] \u003c @p3 or [姓] = @p4\n*/\n```\n\n\n`QueryBuilder` class also provides some other overload functions and `Count` / `Delete` / `Truncate` methods, and so on.\n\n\n\n## Installation\n\nGetting started from downloading [NuGet](https://www.nuget.org/packages/QLimitive) package.\n\n```\ndotnet add package QLimitive\n```\n\n\n\n## License\n\nThis library is provided under [MIT License](http://opensource.org/licenses/MIT).\n\n\n\n## Author\n\nTakaaki Suzuki (a.k.a [@xin9le](https://twitter.com/xin9le)) is software developer in Japan who awarded Microsoft MVP for Developer Technologies (C#) since July 2012.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxin9le%2Fqlimitive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxin9le%2Fqlimitive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxin9le%2Fqlimitive/lists"}