{"id":19992668,"url":"https://github.com/sdcb/sdmap","last_synced_at":"2026-01-14T06:31:23.071Z","repository":{"id":41551083,"uuid":"71871939","full_name":"sdcb/sdmap","owner":"sdcb","description":"A template engine for writing dynamic sql.","archived":false,"fork":false,"pushed_at":"2024-12-02T06:20:36.000Z","size":573,"stargazers_count":98,"open_issues_count":0,"forks_count":22,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-12-10T04:03:01.276Z","etag":null,"topics":["codegenerator","ibatis","template-engine"],"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/sdcb.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}},"created_at":"2016-10-25T07:42:48.000Z","updated_at":"2025-07-24T02:16:16.000Z","dependencies_parsed_at":"2023-12-22T04:32:38.952Z","dependency_job_id":"5349bd38-8967-4e3b-b25f-9618f34354a1","html_url":"https://github.com/sdcb/sdmap","commit_stats":{"total_commits":321,"total_committers":5,"mean_commits":64.2,"dds":"0.19626168224299068","last_synced_commit":"cf9a6cfdd29aea194e3310ea8f10965ceb62b3c7"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/sdcb/sdmap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdcb%2Fsdmap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdcb%2Fsdmap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdcb%2Fsdmap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdcb%2Fsdmap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sdcb","download_url":"https://codeload.github.com/sdcb/sdmap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdcb%2Fsdmap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28412211,"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":["codegenerator","ibatis","template-engine"],"created_at":"2024-11-13T04:52:15.993Z","updated_at":"2026-01-14T06:31:23.048Z","avatar_url":"https://github.com/sdcb.png","language":"C#","readme":"# sdmap [![NuGet](https://img.shields.io/nuget/v/sdmap.svg)](https://nuget.org/packages/sdmap.mkl)\nA template engine for writing dynamic sql:\n![vstool](./sdmap/src/sdmap.vstool/vstool.png)\n\nsdmap has it's own benifics over other dynamic SQL package/framework (like iBatis.NET):\n* Very simple Domain-Specific-Language(or DSL) to enhance the dynamic SQL expression\n* Implemented by Common-Intermediate-Language(or CIL) to ensure the performance\n* Visual Studio integrated, with code-highlight, code-folding and navigate-to features supported\n* Support all majoy databases like MySQL, SQL Server, SQLite (whenever Dapper supports :))\n* Even is able to extend to databases that is not relational, like Neo4j\n* Fully unit test covered.\n\n## NuGet Package:\n* https://www.nuget.org/packages/sdmap\n* https://www.nuget.org/packages/sdmap.ext\n* https://www.nuget.org/packages/sdmap.ext.Dapper\n\n## How to use? (with Dapper)\n1. Install package: `sdmap.ext.Dapper`\n\nYou can just only install `sdmap.ext.Dapper` since it will automatically install all dependencies including `sdmap` and `sdmap.ext`.\n\n2. Create a empty text file, and renames it into .sdmap\n3. Set the file \"Build operation\" from \"None\" to \"Embedded Resource\" in item Property Window.\n4. Write some SQL statements into sdmap file, a minimum sdmap file may looks as following:\n\n```\nsql GetUserById\n{\n    SELECT * FROM [User] WHERE Id = @Id\n}\n```\n\nNote: the `namespace NS { ... }` is not required.\n\n5. Initialize sdmap by this code(the `Program` means the assembly where sdmap be located): \n```\nDbConnectionExtensions.SetEmbeddedSqlAssembly(typeof(Program).Assembly);\n```\n\nNote:\n  * This code MUST be running before any database operations.\n  * This code ONLY need to execute ONCE per process.\n  * There are many other ways to initialize sdmap, you SHOULD pick up one of those depending on what you need:\n    * `SetSqlDirectory` - initialize from a physical on-disk folder\n    * `SetSqlDirectoryAndWatch` - initialize from a physical on-disk folder, and watch changes when edit those folder sdmap files\n    * `SetEmbeddedSqlAssembly` - initialize from a single assembly, and sdmap automatically parse all the resource file that ends with `.sdmap`\n    * `SetEmbeddedSqlAssemblies` - initialize from multiple assemblies, and sdmap automatically parse all the resource file that ends with `.sdmap`\n    * `SetSqlEmiter` - advanced, you can write your own `ISdmapEmiter`.\n6. And you're good to go!\n7. If you want to emit the SQL statement manully, you may want to call: \n\n```\nstring finalSqlToExecute = DbConnectionExtensions.EmitSql(sqlMapId, parameterObject);\n```\n\n\n## Visual Studio 2022 extension:\nhttps://marketplace.visualstudio.com/items?itemName=sdmapvstool.sdmapvstool\n\n## How to Compile\n1. Install .NET Core SDK(https://www.microsoft.com/net/download/core)\n2. Download code(`git clone https://github.com/sdcb/sdmap.git`)\n3. JRE 1.6+ is preferred for building performance purpose but not required\n4. dotnet restore\n5. dotnet build\n\n## Release notes: \nhttps://github.com/sdcb/sdmap/blob/master/ReleaseNotes.md\n\n## Document/Wiki\nhttps://github.com/sdcb/sdmap/wiki\n","funding_links":[],"categories":["C\\#"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdcb%2Fsdmap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsdcb%2Fsdmap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdcb%2Fsdmap/lists"}