保护EntityFramework核心应用程序使用的SQLite数据库 [英] Protect SQLite database used by EntityFramework Core Application

查看:221
本文介绍了保护EntityFramework核心应用程序使用的SQLite数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用EntityFramework Core 1.0(EntityFramework 7的新名称)来管理C#桌面应用程序中的SQLite数据库。

I'm trying to use EntityFramework Core 1.0 (new name for EntityFramework 7) to manage an SQLite database in a C# Desktop application.

我阅读了官方文档并我的测试应用程序正常工作。

I read official documentation and my test-application works.

我的问题是:可以用密码保护数据库吗?

My question is: is it possibile to password-protect the database?

我知道有很多方法可以做到,它也存在允许执行此操作的.NET类System.Data.SQLite,但是如何使用EFCore 1做到这一点?

I know that there are lot of way to do it, it exists also the .NET class System.Data.SQLite that allow to do that, but how to do it using EFCore 1?

我不知道是否有可能。

感谢您的帮助,

Enrico

推荐答案

使用EntityFramework Core 2.0(EFCore 2.0),可以使用加密的SQLite数据库。

With EntityFramework Core 2.0 (EFCore 2.0), It is possible to use Encrypted SQLite database.

将SQLite加密(SQLCiher)数据库与EFCore一起使用的步骤

Steps for using SQLite Encrypted (SQLCiher) database with EFCore


  1. 添加Microsoft.EntityFrameworkCore的引用在
    项目中进行设计。

  1. Add the reference of Microsoft.EntityFrameworkCore.Design in your project.

添加
Microsoft.EntityFrameworkCore.Sqlite.Core的引用。
这一步非常重要。不要添加
Microsoft.EntityFrameworkCore.Sqlite的引用。否则它将不起作用。

Add the reference of Microsoft.EntityFrameworkCore.Sqlite.Core. This is really important step. Don't add the reference of Microsoft.EntityFrameworkCore.Sqlite. Otherwise it will not work.

添加对SQLitePCLRaw.bundle_sqlcipher的引用。对于加密
是必需的。添加以下行ExcludeAssets = All是
重要,否则将无法使用。有关详细信息,请参见以下链接
http://www.bricelam .net / 2016/06/13 / sqlite-encryption.html

Add the reference of SQLitePCLRaw.bundle_sqlcipher. For encryption it is required. Add the following line ExcludeAssets="All" is important otherwise it will not work. For details refer to following link http://www.bricelam.net/2016/06/13/sqlite-encryption.html

Github

这篇关于保护EntityFramework核心应用程序使用的SQLite数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆