So I use this role:
DropCreateDatabaseIfModelChanges
But theres one table that I to preserve its data..
So is there a way to exclude one table or to preserve one table data?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, there is no way to exclude a table, because as the name implies it will Drop the whole database.
However you can inherit from the intializer and override the seed method to reinsert your data:
If you want something more complex you need to implement
IDatabaseInitializer<TContext>directly, something like: