EF 4.1 Code First and Existing Database and .NET Membership

后端 未结 6 1468
南旧
南旧 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:39

    While you are developing, create 2 databases and two connection strings. One for SqlMembership (using aspnet_regsql) and one for your EF Application. If you would like to merge them into a single DB in production, just change the connection string in web.config.release to be the same. Then, EF model changes will just drop your apps db and not your membership DB.

    By treating your authentication component separately, you will naturally decouple your authentication system from your application system. Then, if you wish to change membership providers, you will be better setup.

    As the system grows, you will likely need to support non-pure models without EF code first, so this is a good template for going down that path.

提交回复
热议问题