I am currently stuck with one of my projects and need some help..
I created a table valued function in MSSQL that returns a table and a computed column (Distance) and have mapped it in Entity Framework 5 using the Entity Designer.
The problem is that I can only map the results either as a complex type or an entity that is in my model class. I need to use one of the Navigation Property in the entity and hence, I am stuck with using my entity class.
However, because the column Distance is not a real column in my table, I have no way of getting that value for every entity for the table valued function.
Is there any way of hacking around this? I've tried using a partial class but the function would not map the Distance column as a property for me.
Here's a little code to explain what I'm trying to do here :
IQueryable<Deal> deals = context.GetDealsByTypeLocationSearch(latitude, longitude);
foreach (var d in deals)
{
Console.Write(d.Distance);
}
The distance value is null when I tried to create a partial class for my entity Deal.