Note that there are some explanatory texts on larger screens.

plurals
  1. POEntity Framework - redundant connection string
    primarykey
    data
    text
    <p>I'm using Entity Framework 4 in my project. The Framework has created its own connection string, so my <code>web.config</code> connectionStrings section file looks following:</p> <pre><code> &lt;connectionStrings&gt; &lt;add name="ApplicationServices" connectionString="data source=localhost;user id=user;pwd=pass;initial catalog=VNK" providerName="System.Data.SqlClient" /&gt; &lt;add name="VNKEntities" connectionString="metadata=res://*/VNKModel.csdl|res://*/VNKModel.ssdl|res://*/VNKModel.msl;provider=System.Data.SqlClient;provider connection string=&amp;quot;Data Source=localhost;Initial Catalog=VNK;User ID=user;Password=pass;MultipleActiveResultSets=True&amp;quot;" providerName="System.Data.EntityClient" /&gt; &lt;/connectionStrings&gt; </code></pre> <p>The first connection string called <code>ApplicationServices</code> is my original one. The second, called <code>VNKEntities</code> has been created while generating the model.</p> <p>When I checked the generated <strong>*.edmx</strong> file, I found that this model is referencing its connection string, which is shown below:</p> <pre><code> /// &lt;summary&gt; /// Initializes a new VNKEntities object using the connection string found in the 'VNKEntities' section of the application configuration file. /// &lt;/summary&gt; public VNKEntities() : base("name=VNKEntities", "VNKEntities") { this.ContextOptions.LazyLoadingEnabled = true; OnContextCreated(); } </code></pre> <p>My question is how can I get rid of the <code>VNKEntities</code> connection string, and leave only <code>ApplicationServices</code>, to which I will be referencing from my model? I would like to have only one connection string to the database, because I'm using only one database (replacing the constructor parameter from <code>name=VNKEntities</code> to <code>name=ApplicationServices</code> is not working).</p> <p>Regards</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload