{"id":13592044,"url":"https://github.com/trampster/SqlSrcGen","last_synced_at":"2025-04-08T18:31:43.283Z","repository":{"id":162886949,"uuid":"636175939","full_name":"trampster/SqlSrcGen","owner":"trampster","description":"SqlSrcGen","archived":false,"fork":false,"pushed_at":"2023-09-26T09:23:08.000Z","size":366,"stargazers_count":10,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-06T12:45:57.835Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trampster.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["trampster"]}},"created_at":"2023-05-04T09:26:00.000Z","updated_at":"2023-12-10T08:58:59.000Z","dependencies_parsed_at":"2024-05-28T03:15:42.048Z","dependency_job_id":"c31c6b9e-6908-4dce-a881-a68ad8a9d33c","html_url":"https://github.com/trampster/SqlSrcGen","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trampster%2FSqlSrcGen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trampster%2FSqlSrcGen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trampster%2FSqlSrcGen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trampster%2FSqlSrcGen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trampster","download_url":"https://codeload.github.com/trampster/SqlSrcGen/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247902207,"owners_count":21015411,"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":"2024-08-01T16:01:05.154Z","updated_at":"2025-04-08T18:31:41.683Z","avatar_url":"https://github.com/trampster.png","language":"C#","readme":"# ![Logo](https://raw.githubusercontent.com/trampster/SqlSrcGen/main/Icon/SqlSrcGen64.png) SqlSrcGen\nSqlSrcGen is a SQL first, reflection free micro ORM for SQLite using c# source generators.\nThe class definitions and Object Relational Mappings are created automatically from your SQL CREATE TABLE commands.\n\n## Advantages\n* No need to manually define c# classes for your tables\n* High performance - mapping code is reflection free and optimized at compile time\n* SQL code is compile time checked\n* AOT friendly - no reflection \n\n## Getting Started\n1. Create a .sql file in your project which includes the CREATE TABLE SQL commands defining your database.\n```sql\nCREATE TABLE contact (name Text not null primary key, email Text not null);\n```\n\n2. Include that .sql file as AdditionalFiles in your .csproj\n\n```xml\n\u003cItemGroup\u003e\n    \u003cAdditionalFiles Include=\"SqlSchema.sql\" /\u003e\n\u003c/ItemGroup\u003e\n```\n3. Do crud operations on the tables\n\n```c#\nvar database = new Database(databaseName);\n\n// create the table\ndatabase.CreateContactTable();\n\n// insert a record\ndatabase.InsertContact(new Contact() \n{ \n    Name = \"Steve Rogers\", \n    Email = \"steve@avengers.com\"\n});\n\n// query all records in the table\nvar list = new List\u003cContact\u003e();\ndatabase.AllContacts(list);\n\n// get row via primary key, (only generated for tables with a primary key)\nvar contact = new Contact();\nbool found = database.GetContact(contact, \"Steve Rogers\");\n\n// delete all rows from table\ndatabase.DeleteAllContacts();\n\n// delete a row via primary key (only generated for tables with a primary key)\ndatabase.DeleteContact(\"Steve Rogers\");\n\n// Begin a transaction\ndatabase.BeginTransaction();\n\n// Commit a transaction\ndatabase.CommitTransaction();\n\n// Rollback a transaction\ndatabase.RollbackTransaction();\n```\n\n## Future Work\nSqlSrcGen currently only supports basic crud operations generated directly from sql table definitions. Future features include:\n* Custom queries (select, joins etc)\n","funding_links":["https://github.com/sponsors/trampster"],"categories":["C#","C\\#"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrampster%2FSqlSrcGen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrampster%2FSqlSrcGen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrampster%2FSqlSrcGen/lists"}