Reputation: 5626
Is there a way to map a returned column to a differently-named property when using ExecuteStoreQuery
? This leaves Value
as 0
in both EF5 and EF6:
MyObject obj = ((IObjectContextAdapter)context).ObjectContext.ExecuteStoreQuery<MyObject>(
"SELECT [val] = 55.0"
).Single();
Here's the class:
public class MyObject
{
[Column("val")]
public decimal Value { get; set; }
}
It sets to 55, of course, if I SELECT [Value]
.
Upvotes: 1
Views: 294
Reputation: 5626
This feature can be tracked at Make SqlQuery (etc.) honor [Column]. It is highly visible to the EF team, but it has not yet been implemented.
For now, however, it seems that classes have to match the SQL query result set.
Upvotes: 1