Parbad.Storage.EntityFrameworkCore 4.0.0

Prefix Reserved
dotnet add package Parbad.Storage.EntityFrameworkCore --version 4.0.0
                    
NuGet\Install-Package Parbad.Storage.EntityFrameworkCore -Version 4.0.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="Parbad.Storage.EntityFrameworkCore" Version="4.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Parbad.Storage.EntityFrameworkCore" Version="4.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Parbad.Storage.EntityFrameworkCore" />
                    
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 Parbad.Storage.EntityFrameworkCore --version 4.0.0
                    
#r "nuget: Parbad.Storage.EntityFrameworkCore, 4.0.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 Parbad.Storage.EntityFrameworkCore@4.0.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=Parbad.Storage.EntityFrameworkCore&version=4.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Parbad.Storage.EntityFrameworkCore&version=4.0.0
                    
Install as a Cake Tool

Parbad.Storage.EntityFrameworkCore

Stores the payments and transactions of Parbad, the online payment library for .NET, with Entity Framework Core, in any database that EF Core supports (SQL Server, PostgreSQL, MySQL, SQLite, Oracle, ...).

The package is built against EF Core 8 and works with the EF Core version of your application (8, 9 or 10).

In your application's database

Add Parbad's entities to your own DbContext:

public class ShopDbContext : DbContext
{
    public ShopDbContext(DbContextOptions<ShopDbContext> options) : base(options)
    {
    }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        base.OnModelCreating(modelBuilder);

        modelBuilder.UseParbad();
    }
}

Register the context with AddDbContextFactory (or AddPooledDbContextFactory) and tell Parbad to use it:

using Parbad.Storage.EntityFrameworkCore.Builder;

builder.Services.AddDbContextFactory<ShopDbContext>(options => options.UseSqlServer(connectionString));

builder.Services.AddParbad()
       .ConfigureStorage(storage => storage.UseEfCore<ShopDbContext>());

Parbad creates a short-lived context from the factory for each of its operations. It therefore never saves changes that your code has pending on its own context. AddDbContextFactory also registers ShopDbContext itself, so you can keep injecting it as before.

Parbad's tables are part of your model, so they are created and updated by your own migrations:

dotnet ef migrations add AddParbad
dotnet ef database update

In a database of its own

Parbad's own ParbadDataContext keeps the tables in a separate database, with separate migrations:

builder.Services.AddParbad()
       .ConfigureStorage(storage => storage.UseEfCore(options =>
       {
           options.ConfigureDbContext = db => db.UseSqlServer(connectionString,
                                                              sql => sql.MigrationsAssembly("Shop.Migrations"));
       }));

Tables

The tables are payment and transaction in the schema parbad. To change them:

modelBuilder.UseParbad(options =>
{
    options.DefaultSchema = "shop";
    options.PaymentTableOptions.Name = "parbad_payment";
    options.TransactionTableOptions.Name = "parbad_transaction";
});

With ParbadDataContext, set the same properties on the options of UseEfCore(options => ...).

Upgrading from Parbad 3.x

Parbad 4 adds three columns to the payment table: status, refunded_amount and bank_reference. Add a migration after the upgrade. Existing rows need no data migration: their status follows from their existing columns, and their refunds from their transactions.

More information

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
4.0.0 0 11/7/2026
1.7.0 53 11/5/2026
1.6.0 11,368 11/17/2024
1.5.0 711 10/28/2024
1.4.0 15,156 11/20/2022
1.3.1 14,095 5/6/2021
1.3.0 1,371 4/10/2021
1.2.0 1,629 12/13/2020
1.1.0 3,364 7/12/2020
1.0.6 1,050 4/17/2020
1.0.4 905 4/14/2020
1.0.3 1,031 1/18/2020
1.0.2 938 12/27/2019
1.0.1 1,046 6/18/2019
1.0.0 1,073 6/14/2019