title: Strange LINQ to SQL .Union() error
body: <p>(See at the bottom for a full repro)</p>
  
  <p>With the following entity ...</p>
  
  <pre><code>[Table]
  internal sealed class Employee
  {
      private EntityRef&lt;Employee&gt; manager;
  
      [Column(IsPrimaryKey = true, IsDbGenerated = true)]
      private int Id;
  
      [Column]
      private int? ManagerId;
  
      [Column]
      internal bool IsOverpaid;
  
      [Association(Name = "Manager_Subordinate", Storage = "manager", ThisKey = "ManagerId", IsForeignKey = true)]
      internal Employee Manager
      {
          get { return this.manager.Entity; }
          set { this.manager.Entity = value; }
      }
  }
  </code></pre>
  
  <p>... this query fails with a NotSupportedException, with the message "Types in Union or Concat are constructed incompatibly.":</p>
  
  <pre><code>var overpaidTopManagers =
      from employee in context.Employees
      where employee.IsOverpaid &amp;&amp; (employee.Manager == null)
      select employee;
  var managersWithOverpaidSubordinates =
      from employee in context.Employees
      where employee.IsOverpaid &amp;&amp; (employee.Manager != null)
      select employee.Manager;
  var query = overpaidTopManagers.Union(managersWithOverpaidSubordinates);
  </code></pre>
  
  <p>I don't really understand why, both queries produce the same type of entity, so it shouldn't be a problem to union them?</p>
  
  <p>Full repro follows:</p>
  
  <pre><code>using System;
  using System.Data.Linq;
  using System.Data.Linq.Mapping;
  using System.Linq;
  
  internal static class Program
  {
      private static void Main(string[] args)
      {
          using (var context = new Context("Whatever.sdf"))
          {
              if (!context.DatabaseExists())
              {
                  context.CreateDatabase();
              }
  
              var overpaidTopManagers =
                  from employee in context.Employees
                  where employee.IsOverpaid &amp;&amp; (employee.Manager == null)
                  select employee;
              var managersWithOverpaidSubordinates =
                  from employee in context.Employees
                  where employee.IsOverpaid &amp;&amp; (employee.Manager != null)
                  select employee.Manager;
              var query = overpaidTopManagers.Union(managersWithOverpaidSubordinates);
  
              // This throws a NotSupportedException with the Message
              // "Types in Union or Concat are constructed incompatibly."
              foreach (var manager in query)
              {
                  Console.WriteLine(manager.ToString());
              }
          }
      }
  }
  
  [Table]
  internal sealed class Employee
  {
      private EntityRef&lt;Employee&gt; manager;
  
      [Column(IsPrimaryKey = true, IsDbGenerated = true)]
      private int Id;
  
      [Column]
      private int? ManagerId;
  
      [Column]
      internal bool IsOverpaid;
  
      [Association(Name = "Manager_Subordinate", Storage = "manager", ThisKey = "ManagerId", IsForeignKey = true)]
      internal Employee Manager
      {
          get { return this.manager.Entity; }
          set { this.manager.Entity = value; }
      }
  }
  
  internal sealed class Context : DataContext
  {
      internal Table&lt;Employee&gt; Employees;
  
      internal Context(string fileOrServerOrConnection) : base(fileOrServerOrConnection)
      {
          this.Employees = this.GetTable&lt;Employee&gt;();
      }
  }
  </code></pre>