{"id":22938411,"url":"https://github.com/jacraig/sqlhelper","last_synced_at":"2025-04-06T03:09:20.640Z","repository":{"id":65413629,"uuid":"75108917","full_name":"JaCraig/SQLHelper","owner":"JaCraig","description":"SQLHelper is a wrapper around DbConnection/DbCommand and a micro ORM. It automatically handles batching, data conversion, transactions, etc. for you. It's been around even longer than Dapper as part various libraries I've had over the years. ","archived":false,"fork":false,"pushed_at":"2024-10-30T01:02:11.000Z","size":18382,"stargazers_count":24,"open_issues_count":0,"forks_count":8,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-10-30T03:51:10.057Z","etag":null,"topics":["database","microorm","orm","sql"],"latest_commit_sha":null,"homepage":"https://jacraig.github.io/SQLHelper/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JaCraig.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-11-29T18:14:42.000Z","updated_at":"2024-10-30T01:02:15.000Z","dependencies_parsed_at":"2023-11-16T01:30:39.566Z","dependency_job_id":"15a071f1-72cf-42f5-afea-d8a621e7f69c","html_url":"https://github.com/JaCraig/SQLHelper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaCraig%2FSQLHelper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaCraig%2FSQLHelper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaCraig%2FSQLHelper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JaCraig%2FSQLHelper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JaCraig","download_url":"https://codeload.github.com/JaCraig/SQLHelper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247427006,"owners_count":20937201,"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":["database","microorm","orm","sql"],"created_at":"2024-12-14T12:17:51.143Z","updated_at":"2025-04-06T03:09:20.602Z","avatar_url":"https://github.com/JaCraig.png","language":"C#","readme":"# SQLHelper\n\n[![Build status](https://ci.appveyor.com/api/projects/status/h687ovca9m893ww1?svg=true)](https://ci.appveyor.com/project/JaCraig/sqlhelper)\n\nSQLHelper is a simple class to help with running queries against a database.\n\n## Basic Usage\n\nIn order to use the system, you do need register it with your ServiceCollection:\n\n    serviceCollection.AddCanisterModules();\n\t\t\t\t\t\nThis is required prior to using the SQLHelper class for the first time. Once Canister is set up, you can use the SQLHelper class:\n\n    var Configuration = new ConfigurationBuilder()\n                .AddInMemoryCollection()\n                .Build();\n    var Instance = new SQLHelper(Configuration, SqlClientFactory.Instance, \"ConnectionString\");\n\nOr simply ask for an instance using dependency injection:\n\n    public MyClass(SQLHelper helper) { ... }\n\t\nThe SQLHelper class takes in a IConfiguration class, a DbProviderFactory class, and the connection string. The connection string can just be the name of a connection string in your configuration object. Once an instance is set up, you can create a batch, add queries, and then execute them.\n\n    var Results = Instance.CreateBatch()\n                \t\t   .AddQuery(CommandType.Text,\"SELECT * FROM [TestDatabase].[dbo].[TestTable]\")\n                \t\t   .AddQuery(CommandType.Text,\"SELECT * FROM [TestDatabase].[dbo].[TestTable2]\")\n                \t\t   .AddQuery(CommandType.Text,\"SELECT * FROM [TestDatabase].[dbo].[TestTable3]\")\n                \t\t   .Execute();\n\t\t\t\t\t\t   \nThe Results object then holds the results for all 3 queries and is returned as IList\u003cIList\u003cdynamic\u003e\u003e. So in order to get the results from the queries:\n\n    var FirstQueryResults = Results[0];\n\tvar SecondQueryResults = Results[1];\n\tvar ThirdQueryResults = Results[2];\n\nIt is also possible to convert the results from the dynamic type to a class type that you specify:\n\n    var TestTableClasses = FirstQueryResults.Select(x =\u003e (TestTableClass)x).ToList();\n\t\nThe type will be converted automatically for you with no special type conversion required.  SQLHelper also has an ExecuteScalar function:\n\n    var Result = Instance.ExecuteScalar\u003cint\u003e();\n\t\nThis will either return the first value of the first set of results OR it will return the number of rows that were effected depending on whether or not the query was a select or not.\n\n## Installation\n\nThe library is available via Nuget with the package name \"SQLHelper.DB\". To install it run the following command in the Package Manager Console:\n\nInstall-Package SQLHelper.DB\n\n## Build Process\n\nIn order to build the library you will require the following as a minimum:\n\n1. Visual Studio 2022\n\nOther than that, just clone the project and you should be able to load the solution and build without too much effort.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacraig%2Fsqlhelper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjacraig%2Fsqlhelper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacraig%2Fsqlhelper/lists"}