title: Linq query and returning DateTime field in a short date format
body: <p>I have two tables in the database Order and OrderDetails. I am joing them in a Linq query but only pulling data from Orders table. I also have a corresponding class - ABOrders:</p>
  
  <pre><code>[Table("[Order]")]
  public partial class ABOrder
      {
          [Key]
          public int OrderID { get; set; }
          public string Field1 { get; set; }
          public string Field2 { get; set; }
          public DateTime OrderDate { get; set; }
      }
  </code></pre>
  
  <p>The issue is that OrderDate comes with date and time and I just need it as a string in ShortDate format. Originally I have tried:</p>
  
  <pre><code>var result = (from a in ctx.Order
                           join b in ctx.OrderDetails on a.OrderId Equals b.OrderId
                           where a.Field1.Equals(id) &amp;&amp; b.Field1.Contains("TEST")
                           select new myClass.ABOrder
                           {
                               OrderId = a.OrderId,
                               Field1 = a.Field1,
                               Field2=a.Field2, 
                               OrderDate = String.Format("MM/dd/yyyy", a.OrderDate)
                           };
  </code></pre>
  
  <p>but that errored out, so I created a new class:</p>
  
  <pre><code>[Table("[Order]")]
  public partial class CDOrder
      {
          [Key]
          public int OrderID { get; set; }
          public string Field1 { get; set; }
          public string Field2 { get; set; }
          public string OrderDate { get; set; }
      }
  </code></pre>
  
  <p>and tried the following Linq query:</p>
  
  <pre><code>var result = (from a in ctx.Order
                           join b in ctx.OrderDetails on a.OrderId Equals b.OrderId
                           where a.Field1.Equals(id) &amp;&amp; b.Field1.Contains("TEST")
                           select new myClass.ABOrder
                           {
                               OrderId = a.OrderId,
                               Field1 = a.Field1,
                               Field2=a.Field2, 
                               OrderDate = a.OrderDate
                           }).AsEnumerable().Select(x =&gt; new myClass.CDOrder
                           {
                               OrderId = x.OrderId,
                               Field1 = x.Field1,
                               Field2=x.Field2, 
                               OrderDate = String.Format("MM/dd/yyyy", x.OrderDate)                 
                           });
  </code></pre>
  
  <p>And now I am getting error:</p>
  
  <blockquote>
    <p>The entity types 'ABOrder' and 'CDOrder' cannot share table 'Order' because they are not in the same type hierarchy or do not have a valid one to one foreign key relationship with matching primary keys between them.</p>
  </blockquote>
  
  <p>How can I accomplish what i want - retrieve all data from Order table but with data in short format?</p>
  
  <p>P.S. I cannot make any adjustments when displaying data to the user, so i have to do that in my query</p>