title: Entity Framework: Unable to load the specified metadata resource
body: <p>I decided to move <code>Entity Connection String</code> from <code>app.config</code> to code. However after setting it up like this:</p>
  
  <pre><code>    public static string GetConnectionString() {
          string connection = "";
  
          SqlConnectionStringBuilder sqlBuilder = new SqlConnectionStringBuilder();
          sqlBuilder.DataSource = dbServer;
          sqlBuilder.InitialCatalog = dbInitialCatalog;
  
          sqlBuilder.IntegratedSecurity = false;
          sqlBuilder.UserID = dbUserName;
          sqlBuilder.Password = dbPasswWord;
          sqlBuilder.MultipleActiveResultSets = true;
  
          EntityConnectionStringBuilder entity = new EntityConnectionStringBuilder();
         // entity.Name = "EntityBazaCRM";
          entity.Metadata = @"res://*/Data.System.csdl|res://*/Data.System.ssdl|res://*/Data.System.msl";
  
          entity.Provider = "System.Data.SqlClient";
          entity.ProviderConnectionString = sqlBuilder.ToString();
  
          connection = entity.ToString();
  
          return connection;
      }
  </code></pre>
  
  <p>I have an exception thrown <code>Unable to load the specified metadata resource.</code> in .Designer.cs.</p>
  
  <pre><code>    /// &lt;summary&gt;
      /// Initialize a new EntityBazaCRM object.
      /// &lt;/summary&gt;
      public EntityBazaCRM(string connectionString) : base(connectionString, "EntityBazaCRM")
      {
          this.ContextOptions.LazyLoadingEnabled = true;
          OnContextCreated();
      }
  </code></pre>
  
  <p>If I define .Name inside my Entity creator it throws another exception</p>
  
  <p><code>"Other keywords are not allowed when the 'Name' keyword is specified." (System.ArgumentException)  Exception Message = "Other keywords are not allowed when the 'Name' keyword is specified.", Exception Type = "System.ArgumentException"</code></p>
  
  <p>I know I'm missing something that I have to change so that self generated code uses new connection string but where to look for it?</p>