EFCoreExtension 1.8.0

dotnet add package EFCoreExtension --version 1.8.0
                    
NuGet\Install-Package EFCoreExtension -Version 1.8.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EFCoreExtension" Version="1.8.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EFCoreExtension" Version="1.8.0" />
                    
Directory.Packages.props
<PackageReference Include="EFCoreExtension" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add EFCoreExtension --version 1.8.0
                    
#r "nuget: EFCoreExtension, 1.8.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package EFCoreExtension@1.8.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=EFCoreExtension&version=1.8.0
                    
Install as a Cake Addin
#tool nuget:?package=EFCoreExtension&version=1.8.0
                    
Install as a Cake Tool

This package is used for generic repository and mapping entity with models

// Install package in project

// Handle dependency injection. Write this code in startup class or in program class (.NET 6)

services.AddScoped(typeof(IRepository<>), typeof(Repository<>)); services.AddScoped(typeof(IGetService<>), typeof(GetService<>)); services.AddScoped(typeof(ICrudService<>), typeof(CrudService<>)); //Create generic repository for entity

EntityName (entity class name - Account)

public class EntityNameRepositoryService : CrudService<EntityName>, IEntityNameRepositoryService { public EntityNameRepositoryService(IRepository<EntityName> repository) : base(repository) { } }

public interface IEntityNameRepositoryService : ICrudService<EntityName> { } // Use repository services

................................

private readonly IEntityNameRepositoryService _entityNameRepositoryService;

public HomeController(IEntityNameRepositoryService entityNameRepositoryService) { this._entityNameRepositoryService = entityNameRepositoryService; }

{

var item = _entityNameRepositoryService.Get(x ⇒ x.ID == Id); var items = _entityNameRepositoryService.GetAll(x ⇒ x.Name == "name");

              .Add(entityItem)
              .Update(entityItem);
              .Delete(x => x.ID == Id)

}

For execute stored procedure follow these steps :- Make a model with fields as stored procedure result

public class SP_Name_Result { public long ID { get; set; } public string Name { get; set; } public long Col1 { get; set; } public int Col2 { get; set; } public DateTime DateCol { get; set; } }

Then make class for execute functions

using EFCoreExtension.Extensions;

using EFCoreExtension.Utility;

using Microsoft.EntityFrameworkCore;

public static class ExecuteSPExtensions {

public static async Task<IList<SP_Name_Result>> SP_Name(this DbContext _context, long? Param1, int? Param2, string Param3)
{

     var param1Parameter = Param1.HasValue ?
         new ObjectParameter("Param1", Param1) :
        new ObjectParameter("Param1", typeof(long));

    var param2Parameter = Param2.HasValue ?
        new ObjectParameter("Param2", Param2) :
        new ObjectParameter("Param2", typeof(int));

    var param3Parameter = Param3 != null ?
        new ObjectParameter("Param3", Param3) :
        new ObjectParameter("Param3", typeof(string));

    return await _context.ExecuteFunctionAsync<SP_Name_Result>("SP_Name", param1Parameter, param2Parameter , param3Parameter );
}

}

Call function ----

var _result = (await _context.SP_Name( param1, param2, param3));

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.8.0 222 3/30/2024
1.4.2 569 9/19/2022
1.4.1 481 9/19/2022
1.4.0 477 9/19/2022
1.3.0 481 9/17/2022
1.2.0 467 9/16/2022
1.1.0 490 9/16/2022
1.0.0 479 8/11/2022