Franz.Common.EntityFramework.PostGres 1.2.62

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

// Install Franz.Common.EntityFramework.PostGres as a Cake Tool
#tool nuget:?package=Franz.Common.EntityFramework.PostGres&version=1.2.62                

Franz.Common.EntityFramework.Postgres

A dedicated library within the Franz Framework that extends Entity Framework Core support for PostgreSQL using the Npgsql.EntityFrameworkCore.PostgreSQL provider. This package simplifies PostgreSQL configuration and integration for .NET applications, supporting both single-tenant and multi-tenant environments.


Features

  • PostgreSQL Integration:
    • Leverages Npgsql.EntityFrameworkCore.PostgreSQL for robust PostgreSQL database support.
  • Service Registration:
    • ServiceCollectionExtensions to streamline dependency injection for PostgreSQL database contexts.
  • Multi-Tenancy Support:
    • Full integration with Franz.Common.MultiTenancy for tenant-based database configurations.
  • Compatibility:
    • Seamless integration with Franz.Common.EntityFramework for shared utilities, repository patterns, and extensions.

Version Information

  • Current Version: 1.2.62
  • Part of the private Franz Framework ecosystem.

Dependencies

This package relies on:

  • Npgsql.EntityFrameworkCore.PostgreSQL (8.0.0): Official EF Core provider for PostgreSQL.
  • Franz.Common.EntityFramework: Core EF utilities and repository patterns.
  • Franz.Common.MultiTenancy: Multi-tenancy support for PostgreSQL databases.

Installation

From Private Azure Feed

Since this package is hosted privately, configure your NuGet client:

dotnet nuget add source "https://your-private-feed-url" \
  --name "AzurePrivateFeed" \
  --username "YourAzureUsername" \
  --password "YourAzurePassword" \
  --store-password-in-clear-text

Install the package:

dotnet add package Franz.Common.EntityFramework.Postgres --version 1.2.62

Usage

1. Configuring PostgreSQL Context

Define a DbContext for PostgreSQL integration:

using Microsoft.EntityFrameworkCore;

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

    public DbSet<Order> Orders { get; set; }
}

2. Dependency Injection

Use ServiceCollectionExtensions to register PostgreSQL database contexts:

using Franz.Common.EntityFramework.Postgres.Extensions;

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddPostgresDbContext<PostgresDbContext>(options =>
            options.UseNpgsql(
                "Host=localhost;Database=MyDatabase;Username=my_user;Password=my_password"
            ));
    }
}

3. Multi-Tenancy Support

Integrate with Franz.Common.MultiTenancy to support multi-tenant PostgreSQL configurations:

using Franz.Common.MultiTenancy;
using Franz.Common.EntityFramework.Postgres.Extensions;

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddMultiTenantPostgresDbContext<PostgresDbContext>(tenantOptions =>
        {
            tenantOptions.ConnectionStringResolver = tenantId =>
                $"Host=localhost;Database=Tenant_{tenantId};Username=my_user;Password=my_password";
        });
    }
}

Integration with Franz Framework

The Franz.Common.EntityFramework.Postgres package integrates seamlessly with:

  • Franz.Common.EntityFramework: Shared repository patterns and utilities.
  • Franz.Common.MultiTenancy: Simplifies tenant-specific database configurations.

Ensure these dependencies are installed to leverage the library's full capabilities.


Contributing

This package is part of a private framework. Contributions are limited to the internal development team. If you have access, follow these steps:

  1. Clone the repository.
  2. Create a feature branch.
  3. Submit a pull request for review.

License

This library is licensed under the MIT License. See the LICENSE file for more details.


Changelog

Version 1.2.62

  • Added ServiceCollectionExtensions for PostgreSQL context registration.
  • Introduced multi-tenancy support with Franz.Common.MultiTenancy.
  • Full compatibility with Franz.Common.EntityFramework repository patterns.
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.2.64 8 1/29/2025
1.2.63 28 1/27/2025
1.2.62 42 1/8/2025