title: Entity Framework Metadata Problem
body: <p>Using EF 4.0. I have two entity models, both named CoreEntities, but in different assemblies and in difference namespaces.</p>
  
  <p>If I have a single project that references both assmeblies, EF seems to get confused as to what the proper metadata artifacts to load are.</p>
  
  <p>Specifically, I get errors like:</p>
  
  <pre><code>The EntitySet name 'CoreEntities.MyEntities' could not be found.
  </code></pre>
  
  <p>As soon as a remove a reference to one of the assemblies, the errors stop happening.</p>
  
  <p>I'm unsure as to whether this makes a difference, but I am using the following code to genereate my entitiy connection string:</p>
  
  <pre><code>public static string BuildEntityConnectiongString(string entityContextName)
  {
      //Format: metadata=res://*/{EntityContext}.csdl|res://*/{EntityContext}.ssdl|res://*/{EntityContext}.msl;provider=...
      string rawString = System.Configuration.ConfigurationManager.ConnectionStrings["GenericEntityConnectionString"].ConnectionString;
      return rawString.Replace("{EntityContext}", entityContextName);
  }
  </code></pre>
  
  <p>How does EF determine which assembly to look for the embedded meta data in? One would think it would always look in the assembly which contains the model first, but apparently that's not the way it works.</p>
  
  <p>Ideas?</p>