title: Entity Framework stored procedure single result set
body: <p>I am working with a MySQL stored procedure and trying to retrieve the single result set using EF6. My stored procedure contains the simple select statement and I have mapped it into my model. Below is the class generated by EF to map to my stored procedure </p>
  
  <pre><code>public partial class usp_aggregatedLogs_Result
  { 
  }  
  </code></pre>
  
  <p>It's an empty class generated by EF. I have added the properties to this class to map it to the result set returned by stored procedure. </p>
  
  <pre><code> public partial class usp_aggregatedLogs_Result
   {
      public int AccountId { get; set; }
      public string AccountName { get; set; }
      public string ProjectId { get; set; }
      public string ProjectName { get; set; }
      public string SystemId { get; set; }
      public string SystemName { get; set; }
      public string ParameterId { get; set; }
      public string ParameterName { get; set; }
      public Nullable&lt;System.DateTime&gt; TimeStamp { get; set; }
      public long LogId { get; set; }
      public string Type { get; set; }
  }
  </code></pre>
  
  <p>Below is the code generated by EF in the DBContext Class </p>
  
  <pre><code>public virtual ObjectResult&lt;usp_aggregatedLogs_Result&gt; usp_aggregatedLogs(Nullable&lt;System.DateTime&gt; dateFrom, Nullable&lt;System.DateTime&gt; dateTo)
      {
          var dateFromParameter = dateFrom.HasValue ?
              new ObjectParameter("DateFrom", dateFrom) :
              new ObjectParameter("DateFrom", typeof(System.DateTime));
  
          var dateToParameter = dateTo.HasValue ?
              new ObjectParameter("DateTo", dateTo) :
              new ObjectParameter("DateTo", typeof(System.DateTime));
  
          return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction&lt;usp_aggregatedLogs_Result&gt;("usp_aggregatedLogs", dateFromParameter, dateToParameter);
      }
  </code></pre>
  
  <p>I assume that calling this function should return me the result set returned by stored procedure. I am calling it this way </p>
  
  <pre><code>List&lt;usp_aggregatedLogs_Result&gt; ResultList= obj.usp_aggregatedLogs(DateFrom, DateTo).ToList();
  </code></pre>
  
  <p>I receive the result in my ResultList. I receive 43 objects which is correct as my stored procedure returns 43 rows. But I get no values for the properties of these objects. all properties values are either set to 0 or null.it seems like my ResultList objects are not initialized. </p>
  
  <p>I don't know how to properly call my stored procedure and retrieve its result set into my application. </p>
  
  <p>Please help.  </p>