OpenRobot.Framework.EntityFrameworkCore.PostgreSQL 2.0.0

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

OpenRobot.Framework.EntityFrameworkCore.PostgreSQL

NuGet .NET

OpenRobot.Framework.EntityFrameworkCore.PostgreSQL 是 OpenRobot Web 框架的 PostgreSQL 数据库提供程序实现包,包含 PostgreSQL 的 EF Core 迁移文件、DbContext 配置器和 ABP 模块。

特性

  • PostgreSQL 支持 - 基于 Npgsql.EntityFrameworkCore.PostgreSQL 8.0.4
  • 独立迁移管理 - 独立的迁移文件目录,与其他数据库提供程序不冲突
  • ABP 模块集成 - 即插即用的 WebFrameworkPostgreSqlModule
  • 设计时工厂 - 内置 IDesignTimeDbContextFactory,支持命令行迁移操作
  • 多租户支持 - 完整的多租户架构支持

安装

dotnet add package OpenRobot.Framework.EntityFrameworkCore.PostgreSQL

或在 Visual Studio 的 NuGet 包管理器控制台中运行:

Install-Package OpenRobot.Framework.EntityFrameworkCore.PostgreSQL

快速开始

1. 添加模块依赖

using Abp.Modules;
using OpenRobot.Framework.EntityFrameworkCore;

[DependsOn(
    typeof(WebFrameworkWebCoreModule),
    typeof(WebFrameworkPostgreSqlModule))]
public class MyWebHostModule : AbpModule
{
    // ...
}

2. 配置连接字符串

appsettings.json 中配置:

{
  "ConnectionStrings": {
    "DbType": "PostgreSQL",
    "WebFramework": "Host=localhost;Port=5432;Database=webframework;Username=postgres;Password=your_password"
  }
}

3. 创建迁移

cd web/OpenRobot.Framework.EntityFrameworkCore.PostgreSQL
dotnet ef migrations add InitPgSql -o Migrations

4. 更新数据库

dotnet ef database update -s ../OpenRobot.Framework.Web.Host

依赖项

包名 版本 用途
Npgsql.EntityFrameworkCore.PostgreSQL 8.0.4 PostgreSQL EF Core 提供程序
OpenRobot.Framework.EntityFrameworkCore 2.0.0 抽象核心层(DbContext 定义)
OpenRobot.Framework.EFCommon 2.0.0 EF Core 共享配置
OpenRobot.Framework.Common 2.0.0 公共组件库

系统要求

  • .NET 8.0 或更高版本
  • PostgreSQL 12+

目录结构

OpenRobot.Framework.EntityFrameworkCore.PostgreSQL/
├── Migrations/              # PostgreSQL 迁移文件
├── PostgreSqlDbConfigurer.cs       # DbContext 配置器
├── WebFrameworkPostgreSqlModule.cs  # ABP 模块
└── WebFrameworkDbContextFactory.cs  # 设计时工厂

在框架中的位置

OpenRobot.Framework.Web.Host
    ├── OpenRobot.Framework.Web.Core
    │   └── OpenRobot.Framework.EntityFrameworkCore (抽象核心层)
    └── OpenRobot.Framework.EntityFrameworkCore.PostgreSQL ✓

相关模块

  • OpenRobot.Framework.EntityFrameworkCore - 抽象核心层
  • OpenRobot.Framework.EntityFrameworkCore.Sqlite - SQLite 提供程序
  • OpenRobot.Framework.EFCommon - EF Core 共享配置

许可证

本项目采用 MIT 许可证。

作者

OpenRobot

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
2.0.0 78 6/5/2026