The results from a stored proc are not mapping properly FOR GUIDs only (uniqueidentifiers in SQL)
menu.Sites = db.Database
.SqlQuery<Site>("get_application_sitemap @application_user_id, @application_name",
new SqlParameter("application_user_id",id),
new SqlParameter("application_name",applicationName)).ToList();
The Site class is shown below
public class Site : EntityBase
{
public Guid ApplicationWebpageGuid
{
get { return application_webpage_guid; }
}
public Guid application_webpage_guid { get; set; }
public Guid? ParentApplicationWebpageGuid
{
get { return parent_application_webpage_guid ?? Guid.Empty; }
}
public Guid? parent_application_webpage_guid { get; set; }
public string Name { get; set; }
public string Url { get; set; }
public int Children { get; set; }
}
The major issue is that the column names coming out of the stored proc are lower cased and underscore spaced. The way I am "mapping" and I use that term loosely is not something I like. The three properties Name, Url, and Children are mapping fine. The casing seems to have no effect, but the underscore spacing is causing me issues. Is there a way to map to a stored procedure? I can't make any changes to the stored proc without causing a major headache.