Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity Framework app.config settings. The default factory and value= with EF6.0

<entityFramework>
   <defaultConnectionFactory 
       type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
         <parameter value="v11.0" />           
      </parameters>
   </defaultConnectionFactory>
</entityFramework>

EDIT: QUESTION was reworded/reworked.

What does <parameter value="v11.0"> mean ? Or better Said Why Have just a Db Value? What about using a full Data Source ? And what is LocalDbConnectionFactory implying

These defaults are hard for me to understand.

Using the Sql default connection factory and parameter used SQL server LocalDbConnectionFactory did not work.

This did work:

<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
  <parameters>
    <parameter value="Data Source=localhost; Integrated Security=True; MultipleActiveResultSets=True" />
like image 325
phil soady Avatar asked Apr 21 '13 13:04

phil soady


1 Answers

The configuration section allows you to specify a default connection factory that Code First should use to locate a database to use for a context. The default connection factory is only used when no connection string has been added to the configuration file for a context.

The following configuration will cause Code First to use a LocalDB instance for contexts that don’t have an explicit connection string set.

<entityFramework>
  <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
    <parameters>
      <parameter value="v11.0" />
    </parameters>
  </defaultConnectionFactory>
</entityFramework>

Update : v11.0 is version of the LocalDb.

more info.

like image 142
Sirwan Afifi Avatar answered Oct 05 '22 04:10

Sirwan Afifi