[英]Entity Framework 6.1.3 and SQL Server CE 4.0 - Code First Setup a password to protect sdf file
I am using Entity Framework 6.1.3
along with SQL Server CE 4.0
. 我正在使用Entity Framework 6.1.3
和SQL Server CE 4.0
。 Is there anyway to put a password on the generated sdf
file the first time it is created? 无论如何,第一次创建生成的sdf
文件时要输入密码吗?
<connectionStrings>
<add name="SQLCompactTest" connectionString="Data Source=|DataDirectory|SqlCeTest.sdf;Password=aaa;" providerName="System.Data.SqlServerCe.4.0" />
</connectionStrings>
I try to add a Password field in my connection string but it does not add a password to the sdf
file. 我尝试在连接字符串中添加密码字段,但没有将密码添加到sdf
文件中。
Thank you. 谢谢。
Adding a Password
field in the connection string DOES add a password to the created sdf
. 在连接字符串中添加Password
字段不会将密码添加到创建的sdf
。 You just have to make sure the connectionstring is used by entityframework, which tripped me over. 您只需要确保实体框架使用了连接字符串,就让我感到震惊。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.