c# - Stop EF from trying to create initial DB -
so got solution create , initialize identity database. problem is, working on keep getting error
cannot create file 'c:\webs\somescheduler\somescheduler\app_data\someschedulerusers.mdf' because exists. change file path or file name, , retry operation. create database failed. file names listed not created. check related errors. description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code. exception details: system.data.sqlclient.sqlexception: cannot create file 'c:\webs\somescheduler\somescheduler\app_data\someschedulerusers.mdf' because exists. change file path or file name, , retry operation. create database failed. file names listed not created. check related errors.
i know exists, want. how stop trying re-create every time try run code develop site?
as always, , appreciated.
add following line context constructor
database.setinitializer<yourcontextclass>(null);
this should enough.
but if want create database if doesn't exists , correctly configure migrations, take @ question how avoid recreate existing database using automatic code first migration
Comments
Post a Comment