title: Executing OPENQUERY Syntax with DbContext.Database.SqlQuery<T> in Entity Framework 6.0
body: <p>We are planning to upgrade from EF4.2 to 6 and are experiencing issues with functionality that worked in 4.2.</p>
  
  <pre><code>SELECT emp_no_alpha as EmployeeNumber, code_user_1 as Code1, emp_name as EmployeeName FROM OPENQUERY(EMS02, 'select emp_no_alpha, code_user_1, emp_name from dce_mms where emp_no_alpha =''   100393'' ')
  </code></pre>
  
  <p>We use the above statement in combination with dbContext.Database.SqlQuery($sql-stmt) to retrieve entities.  This works fine against this model in 4.2:</p>
  
  <pre><code>public abstract class Model_XX_EMS_DCEMMS
      {
          //LEN=9, RIGHT PAD
          [Column("EMP_NO_ALPHA", Order = 0), Key(), DatabaseGenerated(DatabaseGeneratedOption.None)]
          public string EmployeeNumber { get; set; }
  
          //LEN=5, RIGHT PAD
          [Column("CODE_USER_1")]
          public string Code1 { get; set; }
  
          [Column("EMP_NAME")]
          public string EmployeeName { get; set; }
      }
  </code></pre>
  
  <p>However in 6.0, SQL profiler attempts to actually create a Model_XX_EMS_DCEMMS table within the default catalog and never executes the select statement, therefore returning null.  </p>
  
  <p>This is what happens in 6.0:</p>
  
  <pre><code>SELECT Count(*)
  FROM INFORMATION_SCHEMA.TABLES AS t
  WHERE t.TABLE_TYPE = 'BASE TABLE'
      AND (t.TABLE_SCHEMA + '.' + t.TABLE_NAME IN ('dbo.Model_XX_EMS_DCEMMS')
          OR t.TABLE_NAME = 'EdmMetadata')
  CREATE TABLE [dbo].[Model_XX_EMS_DCEMMS] (
      [EMP_NO_ALPHA] [nvarchar](128) NOT NULL,
      [CODE_USER_1] [nvarchar](max),
      [EMP_NAME] [nvarchar](max),
      [Discriminator] [nvarchar](128) NOT NULL,
      CONSTRAINT [PK_dbo.Model_XX_EMS_DCEMMS] PRIMARY KEY ([EMP_NO_ALPHA])
  )
  </code></pre>
  
  <p>Is there a new DbContext configuration or some attributes that I'm missing?</p>