title: Bind the SQL data to model property in Entity Framework
body: <p>Good day to you. I am returning a result as preceding from SQL stored procedure. </p>
  
  <p><a href="https://i.stack.imgur.com/kxBXS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kxBXS.png" alt="enter image description here"></a></p>
  
  <p>Now I am binding the data as follows.</p>
  
  <pre><code> List&lt;EventPhotos&gt; resList = null;
   resList = pe.Database.SqlQuery&lt;EventPhotos&gt;(sqlQuery, param).ToList();
  </code></pre>
  
  <p>Following is my model.</p>
  
  <pre><code>public partial class EventPhotos
      {
          [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
          public EventPhotos()
          {
  
          }        
  
          public EventInfo EventInformation { get; set; }
          public ImageInfo ImageInformation { get; set; }
  
      }
  
      public class EventInfo
      {
          public string EventID { get; set; }
  
          public string EventName { get; set; }
  
          public bool IsJoint { get; set; }
      }
      public class ImageInfo
      {
          public string ImageID { get; set; }
  
          public string EventMediaFolder { get; set; }
  
          public string Image { get; set; }
  
          public string DateTime { get; set; }
  
          public string ImageDescription { get; set; }
  
          public string Action { get; set; }
      }
  </code></pre>
  
  <p>But when I run this, nothing gets mapped to my properties EventInformation and ImageInformation. Is there anyway to achieve this. I know this can be done if we use dataAdapter and assign names to the each table retrieved. But I want to use the Entity framework. Any help is appreciated. Thanks in advance.</p>