title: Entity Framework To A Remote Server (Connection String)
body: <p>I have installed EF Version 6.1.3 on all my projects. I then created a model class, a context class, and installed a MSSQL database on my local computer (I did not have done anything else). Everything worked just perfectly (somehow it knew about my local database).</p>
  
  <p>Model class:</p>
  
  <pre><code>public class Account
      {
          public int Id { get; set; }
          public string Name{ get; set; }
      }
  </code></pre>
  
  <p>DataContext class:</p>
  
  <pre><code>public class MyClassDataContext: DbContext
      {
          public DbSet&lt;Account&gt; Accounts{ get; set; }
      }
  </code></pre>
  
  <p>App.config:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;configuration&gt;
    &lt;configSections&gt;
      &lt;!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --&gt;
      &lt;section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=xxxxxx" requirePermission="false" /&gt;
    &lt;/configSections&gt;
    &lt;entityFramework&gt;
      &lt;defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /&gt;
      &lt;providers&gt;
        &lt;provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /&gt;
      &lt;/providers&gt;
    &lt;/entityFramework&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>I then tried to move it to a remote database and it doesn't work. I tried everything. </p>
  
  <p>What is the right approach, to get the job done?</p>
  
  <p><strong>EDIT:</strong>
  I tried this connection string and nothing happens. The app still tries to connect with the local database.</p>
  
  <pre><code>&lt;connectionStrings&gt;
      &lt;add name="MyClassDataContext" connectionString="Data Source=MyRemoteServer;Initial Catalog=MyRemoteCatalog;Integrated Security=true" providerName="System.Data.SqlClient"/&gt;
    &lt;/connectionStrings&gt;
    &lt;configSections&gt;
  </code></pre>