I'm using Visual Studio Express for web to follow this tutorial http://msdn.microsoft.com/en-US/data/jj193542. The tutorial tells that
By convention DbContext has created a database for you.
If a local SQL Express instance is available (installed by default with Visual Studio 2010) then Code First has created the database on that instance If SQL Express isn’t available then Code First will try and use LocalDb (installed by default with Visual Studio 2012) The database is named after the fully qualified name of the derived context, in our case that is CodeFirstNewDatabaseSample.BloggingContext
So, it should use localdb. But when I try to access my model, I can see in debug that the connection string points to .\SQLEXPRESS, althought I don't have sqlexpress. So, I got a timeout exception ...
Why localdb isn't used ?
Note that if I set explicitly the connectionstring to localdb, it's working ... Note too, that if I use Vs Express for Desktop, it's working too...
What's wrong with the Vs Express for web ?
EF Connections explained Tell EF the factory to use by default, eg
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
<parameters>
<parameter value="Data Source=.; Integrated Security=True; MultipleActiveResultSets=True" />
</parameters>
</defaultConnectionFactory>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With