Entity Framework - redundant connection string

I'm using Entity Framework 4 in my project. The Framework has created its own connection string, so my web.config connectionStrings section file looks following:

  <connectionStrings>
    <add name="ApplicationServices" connectionString="data source=localhost;user id=user;pwd=pass;initial catalog=VNK" providerName="System.Data.SqlClient" />    
    <add name="VNKEntities" connectionString="metadata=res://*/VNKModel.csdl|res://*/VNKModel.ssdl|res://*/VNKModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=localhost;Initial Catalog=VNK;User ID=user;Password=pass;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>

The first connection string called ApplicationServices is my original one. The second, called VNKEntities has been created while generating the model.

When I checked the generated *.edmx file, I found that this model is referencing its connection string, which is shown below:

    /// <summary>
    /// Initializes a new VNKEntities object using the connection string found in the 'VNKEntities' section of the application configuration file.
    /// </summary>
    public VNKEntities() : base("name=VNKEntities", "VNKEntities")
    {
        this.ContextOptions.LazyLoadingEnabled = true;
        OnContextCreated();
    }

My question is how can I get rid of the VNKEntities connection string, and leave only ApplicationServices, 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 name=VNKEntities to name=ApplicationServices is not working).

Regards

9
задан Rui Jarimba 10 April 2013 в 20:17
поделиться