Reputation: 449
I have just created a test SQLServer Express DB when experimenting with EF Code First. The DB has been created correctly and all works. However I cannot see where the connectionstring is for this DB. I expected to find it in Web.config, but not so.
Thanks in advance,
Ed
Upvotes: 1
Views: 56
Reputation: 25694
EF defaults to ./sqlexpress
for the server URI. To change this, add a connectionstring with the name set to the same name as your DBContext class
For example, assuming your DbContext class is called "MyDbContext":
<add name="MyDbContext" connectionString="connectionStringHere" providerName="System.Data.SqlClient" />
Upvotes: 1