【发布时间】:2014-06-04 09:23:13
【问题描述】:
我在 mvc 4 项目中将 UsersContext 作为 dbcontext。我有Web.config 中的加密连接字符串,因为站点位于共享服务器。我的 DbContext 是:
Public Class UsersContext
Inherits DbContext
Public Sub New()
MyBase.New("DefaultConnection")
End Sub
Public Property UserProfiles As DbSet(Of UserProfile)
End Class
“默认连接”在 web.config 中已加密。
我如何使用我的解密函数并初始化连接。
'I want to do Something like this :
Public Sub New()
MyBase.New(MyStringDecrpytor(ConfigurationManager.ConnectionStrings("DefaultConnection").ConnectionString))
End Sub
其中 MyStringDecrpytor 是将连接字符串解密为原始文本的函数。
【问题讨论】:
-
你的密码在哪里?
-
它的公共共享函数和解密连接字符串。
标签: asp.net-mvc entity-framework asp.net-mvc-4 connection-string