ef code first - Why is my web.api project still looking for an .mdf file? -
i have code first web.api project working fine automatically created .mdf in app_data folder. decided move app iis , modify app pool config load user profile, again, no problem. loaded .mdf in visual studios sql explorer , @ point, app pool login web app started failing. no clue why , couldn't prepare it, decided utilize sql express instead of waste more time on it. so, installed sql express, killed migrations, , modified web.config connection string to:
<connectionstrings> <add name="defaultconnection" providername="system.data.sqlclient" connectionstring="data source=.;initial catalog=myapp;integrated security=sspi"/> </connectionstrings>
when seek utilize migrations update-database or run api app, exception saying
cannot attach file 'c:\users\source\myapp\main\solution\myapp.api\app_data\myapp.dataservice.datamodel.appentities.mdf' database 'myapp.dataservice.datamodel.appentities'.
well, makes sense since deleted it, why app still trying connect .mdf file? it's gone , i've changed default connection. i've searched solution referencing .mdf file, nil shows up. missing?
i figured out had name connection string same dbcontext class, in case:
<connectionstrings> <add name="appentities" providername="system.data.sqlclient" connectionstring="data source=.;initial catalog=myapp;integrated security=sspi"/> </connectionstrings>
to match dbcontext derived class
namespace myapp.dataservice.datamodel { internal class appentities : dbcontext
ef-code-first code-first-migrations localdb
No comments:
Post a Comment