Vertizens.SliceR.Operations.EntityFrameworkCore 0.5.0-rc.1.4

This is a prerelease version of Vertizens.SliceR.Operations.EntityFrameworkCore.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Vertizens.SliceR.Operations.EntityFrameworkCore --version 0.5.0-rc.1.4                
NuGet\Install-Package Vertizens.SliceR.Operations.EntityFrameworkCore -Version 0.5.0-rc.1.4                
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="Vertizens.SliceR.Operations.EntityFrameworkCore" Version="0.5.0-rc.1.4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Vertizens.SliceR.Operations.EntityFrameworkCore --version 0.5.0-rc.1.4                
#r "nuget: Vertizens.SliceR.Operations.EntityFrameworkCore, 0.5.0-rc.1.4"                
#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.
// Install Vertizens.SliceR.Operations.EntityFrameworkCore as a Cake Addin
#addin nuget:?package=Vertizens.SliceR.Operations.EntityFrameworkCore&version=0.5.0-rc.1.4&prerelease

// Install Vertizens.SliceR.Operations.EntityFrameworkCore as a Cake Tool
#tool nuget:?package=Vertizens.SliceR.Operations.EntityFrameworkCore&version=0.5.0-rc.1.4&prerelease                

SliceR.Operations.EntityFrameworkCore

Adds to SliceR .NET EntityFramework Core boilerplate functionality for working with entities

Getting Started

If you use EntityFramework Core for doing data access then this library can look at the registered DbContext types and for each entity register a IHandler that are these types: NoFilterQueryableHandler, ByKeyHandler (if primary key), DeleteHandler (if primary key), InsertHandler, and UpdateHandler.

Do this by registering these default handlers after the DbContext types have been registered. Take care that to be able to get the list of entities the code creates the DbContext in this method so make sure they can be created according to their dependencies up to this point. Also confirm that each entity only exists in one DbContext if there are multiple.

services.AddSliceREntityFrameworkCoreDefaultHandlers();

Default Handlers

NoFilterQueryableHandler<TEntity> - Use NoFilter type to signify that no parameters are passed in.
Use it by injecting: IHandler<NoFilter,IQueryable<TEntity>> into your handler.

ByKeyHandler<TKey, TEntity> - Use ByKey<TKey> type to specify the key for the entity.
Use it by injecting: IHandler<ByKey<TKey>,TEntity?> into your handler.

InsertHandler<TEntity> - Use Insert<TEntity> type to specify the entity to insert.
Use it by injecting: IHandler<Insert<TEntity>,TEntity> into your handler. Calls dbContext.SaveChangesAsync();

UpdateHandler<TEntity> - Use Update<TEntity> type to specify the entity to update.
Use it by injecting: IHandler<Update<TEntity>,TEntity> into your handler. Calls dbContext.SaveChangesAsync();

DeleteHandler<TKey, TEntity> - Use Delete<TKey, TEntity> type to specify the entity type and key to delete.
Use it by injecting: IHandler<Delete<TKey, TEntity>, bool> into your handler. It returns true if records affected are > 0.

Custom DbContext Operations

If you have custom queries or multiple operations that need to take place in the same handler simply create a custom handler. Inject the DbContext like normal or possibly use IEntityDbContextResolver if you have multiple DbContext and don't want to hardcode which DbContext it is defined in.
Make sure to register custom handlers first with:

services.AddSlicerRHandllers();
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. 
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.0.0 96 12/7/2024
0.5.0-rc.1.5 57 12/5/2024
0.5.0-rc.1.4 53 12/4/2024
0.5.0-rc.1.2 57 11/28/2024
0.5.0-rc.1.1 55 11/25/2024
0.5.0-rc.1 63 11/22/2024
0.4.0-rc.1.3 52 11/17/2024
0.4.0-rc.1.2 57 11/16/2024
0.4.0-rc.1.1 54 11/15/2024
0.4.0-rc.1 54 11/15/2024
0.3.0-rc.1.1 71 11/11/2024
0.3.0-rc.1 66 11/11/2024
0.2.0-rc.1 62 11/3/2024
0.0.0-alpha.0.1 61 11/3/2024