开发者

Create the Provider db tables after RecreateDatabaseIfModelChanges

开发者 https://www.devze.com 2023-01-25 09:29 出处:网络
I\'m new to EF4, usign CPT4 Code-First and SQLExpress (MVC2 + Ninject but does not matter). It\'s working good but I do have one question/problem. When I change my model the database get drop and crea

I'm new to EF4, usign CPT4 Code-First and SQLExpress (MVC2 + Ninject but does not matter). It's working good but I do have one question/problem. When I change my model the database get drop and created back because I added this line in my OnApplicationStart()

{ Database.SetInitializer<CorpiqDb>(new RecreateDatabaseIfModelChanges<CorpiqDb>()); } 

But I use the Applications Services (membership and role management) that I first created using aspnet_regsql.exe But I don't want to have to run this everytime my model c开发者_如何学Pythonhanges, is it possible to have a script that will add these features to my DB? As for right now, after a change to my model I get this error : Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'.

Thanks!


Use the database generation power pack. It removes the necessity to drop the DB when updating the schema.


What I've done, and it's working quite well, is that I have two seprates DBs, one for my domain and one other for asp.net Membership. When my model changes I call an action that drop model's database and remove users from the membership's one. Event better, I can seed my new database with data I want to have for my test.

0

精彩评论

暂无评论...
验证码 换一张
取 消