代码改变世界

vnext+sqlite3+sqlcipher

  Lecone.JY.HU  阅读(107)  评论(0编辑  收藏  举报

1.在abp.io网站上创建项目并选择数据库为sqlite。

2.默认情况下,sqlite是不加密的。

3.打开appsettings.json

"ConnectionStrings": {
    "Default": "Data Source=de.db;//You need to change to an absolute filename" 
  },

要改成

 "ConnectionStrings": {
    "Default": "Data Source=de.db;" 
  },

现在数据库是在运行目录下,如果要指定目录可以用绝对目录。

4.增加加密

 "ConnectionStrings": {
    "Default": "Data Source=de.db;password=123456;" 
  },

在配置文件中直接加上password会报错:You specified a password in the connection string, but the native SQLite library 'e_sqlite3' doesn't support encryption.”

在xxx.EntityFrameworkCore项目中加nuget :SQLitePCLRaw.bundle_e_sqlcipher ,

如果已经存在db文件,先删除后运行,不然报错。

 

 

参考网站

Entity Framework Core SQLite | Documentation Center | ABP.IO

相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
的风格风格
点击右上角即可分享
微信分享提示