0

Building an MVC 3 app to work with an existing SQL Server 2012 database. The existing database has an existing UserProfile table with id, login, password and email.

I used this quick tutorial to get the nuget simplemembership pack working, and modified it to connect to my existing db and userprofile table. I received an error:

Unable to find the requested .Net Framework Data Provider

it is pointing to this line in the SimpleMembershipMvc3.cs file:

            WebSecurity.InitializeDatabaseConnection(connectionStringName: "MyEntities", userTableName: "UserAccount", userIdColumn: "UserId", userNameColumn: "Login", autoCreateTables: false);

Apparently it is possible to get simplemembership working in an MVC3 DB First scenario, but all the articles I find online are either CodeFirst, or MVC4. I am looking for a complete tutorial for MVC3 DB First.

And I am not tied to SimpleMembership, I will try anything as long as it works. I tried making a custom SQLMembership Provider but could not get it to stop building its own, seperate database.

The only functionality I need to have is register, logon/off (all of which I already had, before I found out about the existence on membership and authentication), and I need to secure the members only pages of the site, which is why I started looking into all this in the first place.

4

1 回答 1

1

尝试以下特定于 EF 数据库第一模型的链接:

将 MVC 4 SimpleMembership 与现有的数据库优先 EF 模型一起使用

虽然它特定于 MVC4,但它应该与 MVC3 非常相似,如果不是,则使用以下两个资源。第一个帮助使用 MVC3 设置 SimpleMembership:

http://anderly.com/2011/08/11/using-simplemembership-in-mvc3/

第二个链接只是解释了如何升级到 MVC4 作为另一种选择,然后参考我在顶部提供的第一个超链接。

http://www.asp.net/whitepapers/mvc4-release-notes#_Toc303253806

于 2013-07-12T22:11:09.170 回答