title: Adapters with Entity framework (C#)
body: <p>I'm trying to use entity framework with an adapter structure, my goal will be to have a single .edmx structure able to manage several connections. </p>
  
  <p>I need to have those adapters:</p>
  
  <ul>
  <li>file based database (SqlServerCE 3.5)</li>
  <li>MySql (with its custom provider from Oracle)</li>
  <li>Oracle (as MySql)</li>
  <li>SqlServer</li>
  </ul>
  
  <p>I have a DAO class that receives a bean (dependency injection object) with data connection from a winform, than due to a specific info in that bean, the DAO will load the correct adapter, through a Database factory class.</p>
  
  <p>My Database factory will load a real adaptor class (e.g. for mysql A_Mysql.cs that implement my abstract adapter class).</p>
  
  <p>In particular, I would like to understand hop I can modify in the adaptor the connection method:</p>
  
  <pre><code>public override Entities createConnection(DbConnection dbBean)
      {
          string conn =
            @"metadata=res://*/Toolkit.Database.External.ADO.ADODatabase.csdl" +
            @"|res://*/Toolkit.Database.External.ADO.ADODatabase.ssdl" +
            @"|res://*/Toolkit.Database.External.ADO.ADODatabase.msl;" +
            @"provider=MySql.Data.MySqlClient;" +
            "provider connection string=\"Persist Security Info=True;server=" + dbBean.Server + ";" +
            "Port=" + dbBean.Port + ";" +
            "User Id=" + dbBean.Username + ";"+
            "Password=" + dbBean.Password + ";" +
            "database=" + dbBean.Schema + "\"";
  
          Entities entities = new Entities(conn);
  
          return entities;
      }
  </code></pre>
  
  <p>to use the same .edmx, in my DAO…</p>
  
  <p>I was pretty sure that this was the right way, unfortunately this system is always returning me errors from SqlCE (I have generated the first .emdx from SqlServerCE, but it does not contain any informations about that database and my App.config file has NOT stored database informations)…</p>
  
  <p>Can you help me? Please write me back for further information, if needed.
  Thank you.</p>