SimpleMembershipInitializer won't initialize

后端 未结 2 1948
滥情空心
滥情空心 2021-01-18 01:45

I am struggling with getting a simplemembership scenario working in my EntityFramework / MVC4 / DatabaseFirst project. I\'ve found plenty of examples for working with code

2条回答
  •  Happy的楠姐
    2021-01-18 01:47

    The provider giving you trouble is the one specified in your connection string which is System.Data.EntityClient. I suspect the problem is because your project is database-first whereas the simple membership is using code-first. I do not think you can mix these approaches in a single database. Try putting it back to where the DefaultConnection is used for IntializeDatabaseConnection. There should have been a DefaultConnection in your web.config generated by the MVC4 scaffolding. This connection string usually uses System.Data.SqlClient as the provider.

    If you want to keep the simple membership in the database used to store domain information (i.e. DALEntities) then you will need to change your method for using EF on the domain to code-first. If you want to keep your project database-first you need to design your own membership schema in the database and develop custom member and role providers. This is probably the best approach if you are really trying to integrate user information into your domain model.

提交回复
热议问题