Good day to you. I am returning a result as preceding from SQL stored procedure.
Now I am binding the data as follows.
List<EventPhotos> resList = null;
resList = pe.Database.SqlQuery<EventPhotos>(sqlQuery, param).ToList();
Following is my model.
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; }
}
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.