EF 4.1 Code First and Existing Database and .NET Membership

后端 未结 6 1439
南旧
南旧 2021-02-01 22:59

I have a database called ApplicationName_Development running on SQL Server 2008 R2 Developer edition on my development box.

I added .NET membership tables to the databas

6条回答
  •  醉梦人生
    2021-02-01 23:56

    Another option could be to use the System.Web.Management namespace. I've had great success with the code below:

    string connectionString = ConfigurationManager.ConnectionStrings["MyDatabaseContext"].ConnectionString;
    string database = "MyDatabaseName";
    SqlServices.Install(database, SqlFeatures.All, connectionString);
    

    It will just create the database and after that you can add users with the standard membership API.

提交回复
热议问题