OpenRobot.Framework.EntityFrameworkCore.Sqlite 2.0.0

dotnet add package OpenRobot.Framework.EntityFrameworkCore.Sqlite --version 2.0.0
                    
NuGet\Install-Package OpenRobot.Framework.EntityFrameworkCore.Sqlite -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.Sqlite" 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.Sqlite" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="OpenRobot.Framework.EntityFrameworkCore.Sqlite" />
                    
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.Sqlite --version 2.0.0
                    
#r "nuget: OpenRobot.Framework.EntityFrameworkCore.Sqlite, 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.Sqlite@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.Sqlite&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=OpenRobot.Framework.EntityFrameworkCore.Sqlite&version=2.0.0
                    
Install as a Cake Tool

OpenRobot.Framework.EntityFrameworkCore.Sqlite

NuGet .NET

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

特性

  • SQLite 支持 - 基于 Microsoft.EntityFrameworkCore.Sqlite 8.0.8
  • 独立迁移管理 - 独立的迁移文件目录,与其他数据库提供程序不冲突
  • ABP 模块集成 - 即插即用的 WebFrameworkSqliteModule
  • 设计时工厂 - 内置 IDesignTimeDbContextFactory,支持命令行迁移操作
  • 轻量开发 - 适用于开发环境和本地测试

安装

dotnet add package OpenRobot.Framework.EntityFrameworkCore.Sqlite

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

Install-Package OpenRobot.Framework.EntityFrameworkCore.Sqlite

快速开始

1. 添加模块依赖

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

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

2. 配置连接字符串

appsettings.json 中配置:

{
  "ConnectionStrings": {
    "DbType": "sqlite",
    "WebFramework": "Data Source=webframework.db"
  }
}

3. 创建迁移

cd web/OpenRobot.Framework.EntityFrameworkCore.Sqlite
dotnet ef migrations add InitSqlite -o Migrations

4. 更新数据库

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

依赖项

包名 版本 用途
Microsoft.EntityFrameworkCore.Sqlite 8.0.8 SQLite 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 或更高版本
  • SQLite 3.x

目录结构

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

在框架中的位置

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

注意事项

  • SQLite 不支持并行事务,WebFrameworkSqliteModule 会自动关闭事务支持
  • 生产环境推荐使用 PostgreSQL 提供程序

相关模块

  • OpenRobot.Framework.EntityFrameworkCore - 抽象核心层
  • OpenRobot.Framework.EntityFrameworkCore.PostgreSQL - PostgreSQL 提供程序
  • 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 81 6/5/2026