{"id":20866174,"url":"https://github.com/snickler/efcore-fluentstoredprocedure","last_synced_at":"2025-05-15T09:08:00.329Z","repository":{"id":20639527,"uuid":"90495913","full_name":"snickler/EFCore-FluentStoredProcedure","owner":"snickler","description":"EFCore Extension that allows a means to map a stored procedure to a class, fluently.","archived":false,"fork":false,"pushed_at":"2025-05-09T17:19:28.000Z","size":105,"stargazers_count":177,"open_issues_count":13,"forks_count":34,"subscribers_count":19,"default_branch":"main","last_synced_at":"2025-05-13T23:56:11.786Z","etag":null,"topics":["csharp","dotnet-core","ef-core","efcore","fluent","netstandard"],"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/snickler.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":"2017-05-06T22:57:47.000Z","updated_at":"2024-11-15T20:59:30.000Z","dependencies_parsed_at":"2024-05-17T17:48:00.974Z","dependency_job_id":"d073a0eb-9cb4-4cb8-87d3-8860748d10eb","html_url":"https://github.com/snickler/EFCore-FluentStoredProcedure","commit_stats":{"total_commits":33,"total_committers":10,"mean_commits":3.3,"dds":0.696969696969697,"last_synced_commit":"683a58a2cae535f3b2f67f31ecfae73c4ce7e521"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snickler%2FEFCore-FluentStoredProcedure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snickler%2FEFCore-FluentStoredProcedure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snickler%2FEFCore-FluentStoredProcedure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snickler%2FEFCore-FluentStoredProcedure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snickler","download_url":"https://codeload.github.com/snickler/EFCore-FluentStoredProcedure/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254310520,"owners_count":22049470,"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":["csharp","dotnet-core","ef-core","efcore","fluent","netstandard"],"created_at":"2024-11-18T05:56:55.149Z","updated_at":"2025-05-15T09:07:55.314Z","avatar_url":"https://github.com/snickler.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Snickler.EFCore\nFluent Methods for mapping Stored Procedure results to objects in EntityFrameworkCore\n\n\n\n[![NuGet](https://img.shields.io/nuget/v/Snickler.EFCore.svg)](https://www.nuget.org/packages/Snickler.EFCore)\n\n\n## Usage\n\n### Executing A Stored Procedure\n\nAdd the `using` statement to pull in the extension method. E.g: `using Snickler.EFCore`\n\n```csharp\n\n      var dbContext = GetDbContext();\n      dbContext.LoadStoredProc(\"dbo.SomeSproc\")\n               .WithSqlParam(\"fooId\", 1)              \n               .ExecuteStoredProc((handler) =\u003e\n                {                  \n                    var fooResults = handler.ReadToList\u003cFooDto\u003e();      \n                    // do something with your results.\n                });\n\n```\n\n### Handling Multiple Result Sets\n\n```csharp\n\n      var dbContext = GetDbContext();\n      dbContext.LoadStoredProc(\"dbo.SomeSproc\")\n               .WithSqlParam(\"fooId\", 1)              \n               .ExecuteStoredProc((handler) =\u003e\n                {                  \n                    var fooResults = handler.ReadToList\u003cFooDto\u003e();      \n                    handler.NextResult();\n                    var barResults = handler.ReadToList\u003cBarDto\u003e();\n                    handler.NextResult();\n                    var bazResults = handler.ReadToList\u003cBazDto\u003e()\n                });\n\n```\n\n### Handling Output Parameters\n\n```csharp\n\n      DbParameter outputParam = null;\n    \n      var dbContext = GetDbContext();\n      dbContext.LoadStoredProc(\"dbo.SomeSproc\")\n               .WithSqlParam(\"fooId\", 1)  \n               .WithSqlParam(\"myOutputParam\", (dbParam) =\u003e\n               {                 \n                 dbParam.Direction = System.Data.ParameterDirection.Output;\n                 dbParam.DbType = System.Data.DbType.Int32;          \n                 outputParam = dbParam;\n               })\n               .ExecuteStoredProc((handler) =\u003e\n                {                  \n                    var fooResults = handler.ReadToList\u003cFooDto\u003e();      \n                    handler.NextResult();\n                    var barResults = handler.ReadToList\u003cBarDto\u003e();\n                    handler.NextResult();\n                    var bazResults = handler.ReadToList\u003cBazDto\u003e()\n                });\n                \n                int outputParamValue = (int)outputParam?.Value;\n\n```\n\n### Using output parameters without returning a result set\n\n```csharp\n\n      DbParameter outputParam = null;\n\n      var dbContext = GetDbContext();\n\n      await dbContext.LoadStoredProc(\"dbo.SomeSproc\")\n            .WithSqlParam(\"InputParam1\", 1)\n            .WithSqlParam(\"myOutputParam\", (dbParam) =\u003e\n            {\n                  dbParam.Direction = System.Data.ParameterDirection.Output;\n                  dbParam.DbType = System.Data.DbType.Int16;\n                  outputParam = dbParam;\n            })\n\n            .ExecuteStoredNonQueryAsync();\n\n      int outputParamValue = (short)outputParam.Value;\n\n```\n\n### Using output parameters without returning a result set but also getting the number of rows affected\n\nMake sure your stored procedure does not contain `SET NOCOUNT ON`.\n\n```csharp\n      int numberOfRowsAffected = -1;\n\n      DbParameter outputParam = null;\n\n      var dbContext = GetDbContext();\n\n      numberOfRowsAffected = await dbContext.LoadStoredProc(\"dbo.SomeSproc\")\n            .WithSqlParam(\"InputParam1\", 1)\n            .WithSqlParam(\"myOutputParam\", (dbParam) =\u003e\n            {\n                  dbParam.Direction = System.Data.ParameterDirection.Output;\n                  dbParam.DbType = System.Data.DbType.Int16;\n                  outputParam = dbParam;\n            })\n\n            .ExecuteStoredNonQueryAsync();\n\n      int outputParamValue = (short)outputParam.Value;\n\n```\n\n### Changing the execution timeout when waiting for a stored procedure to return\n\n```csharp\n\n      DbParameter outputParam = null;\n\n      var dbContext = GetDbContext();\n\n      // change timeout from 30 seconds to 300 seconds (5 minutes)\n      await dbContext.LoadStoredProc(\"dbo.SomeSproc\", commandTimeout:300)\n            .WithSqlParam(\"InputParam1\", 1)\n            .WithSqlParam(\"myOutputParam\", (dbParam) =\u003e\n            {\n                  dbParam.Direction = System.Data.ParameterDirection.Output;\n                  dbParam.DbType = System.Data.DbType.Int16;\n                  outputParam = dbParam;\n            })\n\n            .ExecuteStoredNonQueryAsync();\n\n      int outputParamValue = (short)outputParam.Value;\n\n```\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnickler%2Fefcore-fluentstoredprocedure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnickler%2Fefcore-fluentstoredprocedure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnickler%2Fefcore-fluentstoredprocedure/lists"}