title: Specify an SQL username other than dbo in Code First Entity Framework ( C# ASP.NET MVC 3 )
body: <p>I'm trying to connect to an SQL Server 2008 database in a shared hosting environment from C# from within an ASP.NET MVC 3 application connecting via EF (code first).</p>
  
  <p>My problem is that the generated <code>SELECT</code> statement looks like so:</p>
  
  <pre><code>SELECT ... FROM [dbo].[TableName]
  </code></pre>
  
  <p>which throws the error <code>Invalid object name</code>, but works fine when I do:</p>
  
  <pre><code>SELECT ... FROM [mySQLUserName].[TableName]
  </code></pre>
  
  <p>How do I specify a username other than <code>dbo</code> (e.g. <code>mySQLUserName</code>)?</p>
  
  <hr>
  
  <p><strong>EDIT:</strong></p>
  
  <p>The closest articles I have found that are relevant to this issue are:</p>
  
  <ul>
  <li><a href="http://weblogs.asp.net/scottgu/archive/2010/08/03/using-ef-code-first-with-an-existing-database.aspx">http://weblogs.asp.net/scottgu/archive/2010/08/03/using-ef-code-first-with-an-existing-database.aspx</a></li>
  <li><a href="http://weblogs.asp.net/scottgu/archive/2010/07/23/entity-framework-4-code-first-custom-database-schema-mapping.aspx">http://weblogs.asp.net/scottgu/archive/2010/07/23/entity-framework-4-code-first-custom-database-schema-mapping.aspx</a></li>
  </ul>
  
  <p>with specific emphasis on the second article, however it doesn't specify how to set a username other than <code>dbo</code></p>