verdie-g / Storedprocedureefcore
Licence: mit
Entity Framework Core extension to execute stored procedures
Stars: ✭ 164
Programming Languages
csharp
926 projects
Projects that are alternatives of or similar to Storedprocedureefcore
Simplcommerce
A simple, cross platform, modularized ecommerce system built on .NET Core
Stars: ✭ 3,474 (+2018.29%)
Mutual labels: entity-framework-core, asp-net-core, dotnet-core, dotnetcore
Ocelot
.NET core API Gateway
Stars: ✭ 6,675 (+3970.12%)
Mutual labels: asp-net-core, dotnet-core, dotnetcore
Csharp Datatables Parser
C# Serverside parser for the popuplar jQuery datatables plugin.
Stars: ✭ 119 (-27.44%)
Mutual labels: entity-framework-core, asp-net-core, dotnet-core
Nlayerappv3
Domain Driven Design (DDD) N-LayeredArchitecture with .Net Core 2
Stars: ✭ 138 (-15.85%)
Mutual labels: asp-net-core, dotnet-core, dotnetcore
Sio.core
✔ [ SIOC ] Swastika I/O Core is an all in one platform (e.g CMS, eCommerce, Forum, Q&A, CRM...) ASP.NET Core / Dotnet Core System based on SIOH Framework.
Stars: ✭ 121 (-26.22%)
Mutual labels: asp-net-core, dotnet-core, dotnetcore
Starwars
GraphQL 'Star Wars' example using GraphQL for .NET, ASP.NET Core, Entity Framework Core
Stars: ✭ 559 (+240.85%)
Mutual labels: entity-framework-core, asp-net-core, dotnet-core
Dotnetlabs
.NET Labs -- Show Me the Tips and Tricks and Code
Stars: ✭ 135 (-17.68%)
Mutual labels: entity-framework-core, dotnet-core, dotnetcore
Pieshopcore
A simple pie shopping management system using ASP.NET CORE MVC application
Stars: ✭ 25 (-84.76%)
Mutual labels: entity-framework-core, asp-net-core, dotnet-core
Jetweet
Jetweet is a mini twitter clone with basic functionalities, Made using ASP.NET CORE and Entity framework technologies
Stars: ✭ 29 (-82.32%)
Mutual labels: entity-framework-core, asp-net-core, dotnet-core
Docker Series
Docker Series about containerizing ASP.NET Core app with MySQL..
Stars: ✭ 88 (-46.34%)
Mutual labels: asp-net-core, dotnet-core, dotnetcore
Cronscheduler.aspnetcore
Cron Scheduler for AspNetCore 2.x/3.x or DotNetCore 2.x/3.x Self-hosted
Stars: ✭ 100 (-39.02%)
Mutual labels: asp-net-core, dotnet-core, dotnetcore
Mix.core
🚀 Mixcore CMS is an open source CMS that support both headless and decoupled to easily build any kinds of app/web app/customisable APIs built on top of ASP.NET Core / Dotnet Core. It is a completely open source ASP.NET Core (Dotnet Core) CMS solution. https://mixcore.org
Stars: ✭ 304 (+85.37%)
Mutual labels: asp-net-core, dotnet-core, dotnetcore
Anclafs
ASP.NET Core Library and Framework Support
Stars: ✭ 192 (+17.07%)
Mutual labels: asp-net-core, dotnet-core, dotnetcore
Angular 7 Project With Asp.net Core Apis
Angular 7 Project with ASP.NET CORE APIS | Angular Project
Stars: ✭ 174 (+6.1%)
Mutual labels: asp-net-core, dotnet-core, dotnetcore
Fanray
A blog built with ASP.NET Core
Stars: ✭ 117 (-28.66%)
Mutual labels: entity-framework-core, asp-net-core, dotnet-core
Awesome Microservices Netcore
💎 A collection of awesome training series, articles, videos, books, courses, sample projects, and tools for Microservices in .NET Core
Stars: ✭ 865 (+427.44%)
Mutual labels: asp-net-core, dotnet-core, dotnetcore
Puck Core
Open source, cross platform .NET Core CMS. Fast, scalable, code-first, unobtrusive and extensible with powerful querying and Lucene integration.
Stars: ✭ 115 (-29.88%)
Mutual labels: asp-net-core, dotnet-core, dotnetcore
Dotnetcore
.NET 5 Nuget Packages.
Stars: ✭ 146 (-10.98%)
Mutual labels: mapping, dotnet-core, dotnetcore
Recaptcha.aspnetcore
Google reCAPTCHA v2/v3 for .NET Core 3.x
Stars: ✭ 122 (-25.61%)
Mutual labels: asp-net-core, dotnet-core
Active Directory B2c Dotnetcore Webapp
An ASP.NET Core web application that can sign in a user using Azure AD B2C, get an access token using MSAL.NET and call an API.
Stars: ✭ 160 (-2.44%)
Mutual labels: asp-net-core, dotnetcore
Execute stored procedures with Entity Framework Core
DbContext extension with LoadStoredProc method which creates
an IStoredProcBuilder
to build a stored procedure with a custom
mapping strategy using the provided DbDataReader
extension.
The method handles :
- Extra column in result set
- Extra property in model
- Null values in result set
- Underscores in result set column names ("column_name" is mapped to ColumnName property)
- Int (db) to enumeration (result model) mapping
Example
List<Model> rows = null;
ctx.LoadStoredProc("dbo.ListAll")
.AddParam("limit", 300L)
.AddParam("limitOut", out IOutParam<long> limitOut)
.Exec(r => rows = r.ToList<Model>());
long limitOutValue = limitOut.Value;
ctx.LoadStoredProc("dbo.ReturnBoolean")
.AddParam("boolean_to_return", true)
.ReturnValue(out IOutParam<bool> retParam)
.ExecNonQuery();
bool b = retParam.Value;
ctx.LoadStoredProc("dbo.ListAll")
.AddParam("limit", 1L)
.ExecScalar(out long l);
API
DbContext
IStoredProcBuilder LoadStoredProc(string name)
IStoredProcBuilder
IStoredProcBuilder AddParam<T>(string name, T val); // Input parameter
IStoredProcBuilder AddParam<T>(string name, T val, out IOutParam<T> outParam, int size, byte precision, byte scale); // Input/Ouput parameter
IStoredProcBuilder AddParam<T>(string name, out IOutParam<T> outParam, int size, byte precision, byte scale); // Ouput parameter
IStoredProcBuilder ReturnValue<T>(out IOutParam<T> retParam, int size, byte precision, byte scale);
IStoredProcBuilder SetTimeout(int timeout);
Task ExecAsync(Func<DbDataReader, Task> action, CancellationToken cancellationToken);
Task<int> ExecNonQueryAsync(CancellationToken cancellationToken);
Task ExecScalarAsync<T>(Action<T> action, CancellationToken cancellationToken);
DbDataReader
Task<List<T>> ToListAsync<T>();
Task<Dictionary<TKey, TValue>> ToDictionaryAsync<TKey, TValue>(Func<TValue, TKey> keyProjection);
Task<Dictionary<TKey, List<TValue>>> ToLookupAsync<TKey, TValue>(Func<TValue, TKey> keyProjection);
Task<HashSet<T>> ToSetAsync<T>();
Task<List<T>> ColumnAsync<T>();
Task<List<T>> ColumnAsync<T>(string columnName);
Task<T> FirstAsync<T>();
Task<T> FirstOrDefaultAsync<T>();
Task<T> SingleAsync<T>();
Task<T> SingleOrDefaultAsync<T>();
All these methods have a corresponding async method : ToListAsync, ToDictionaryAsync, ...
Installation
Install-Package StoredProcedureEFCore
Why ?
Stored procedure execution was previously not supported in Entity Framework Core:
- Raw store access APIs: Support for ad hoc mapping of arbitrary types #1862
- Stored procedure mapping support #245
It is now supported since EF Core 2.1 but this library has few advantages compared to FromSql:
- Extra property in the model won't throw an exception. The property keeps its default value
- The interface is easier to use. Output parameters and return values seem difficult to use with EF Core
- Mapping is 30% faster
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].