[英]How to protect ado.net entity generated database on a local machine
I have a C# application in .net 3.5 using SQL Server 2008 R2. 我在使用SQL Server 2008 R2的.net 3.5中有一个C#应用程序。
I am using ado.net Entity Framework to generate the database but after generating it when I remove the database file from SQL Server the framework does not generate the database. 我正在使用ado.net实体框架生成数据库,但是当我从SQL Server删除数据库文件生成数据库之后,该框架不会生成数据库。
I want to generate database on users local machine while installation and have a password on database access and protect the data from being read or modified by a local user rather than my application. 我想在安装时在用户本地计算机上生成数据库,并在访问数据库时使用密码,并保护数据免遭本地用户而不是我的应用程序读取或修改。
So the question is how to achieve this with out encrypting the whole data? 因此,问题是如何在不对整个数据进行加密的情况下实现这一目标?
What is the parallels here? 这里有什么相似之处?
I don't think EF in .NET 3.5 was ever capable of creating a database at runtime. 我认为.NET 3.5中的EF无法在运行时创建数据库。
You'll have to either upgrade to .NET 4 and EF 5 or 6 to use code-first with migrations to handle this, or then you need to write some code to handle that situation yourself, in .NET 3.5. 您必须升级到.NET 4和EF 5或6才能在迁移中使用代码优先功能来解决此问题,或者在.NET 3.5中需要编写一些代码来自行处理这种情况。
Also: a SQL Server database (file) doesn't have a password mechanism like Access or other file-based system do. 另外:SQL Server数据库(文件)没有像Access或其他基于文件的系统那样的密码机制 。 Access to a SQL Server database is handled by the SQL Server itself by means of logins on the server, users on the database-level and permissions for those users. SQL Server本身通过在服务器上的登录,数据库级别的用户以及这些用户的权限来处理对SQL Server数据库的访问。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.