views:

22

answers:

1

I'm new to EF, and trying to work out the best way to do something

I have a procedure that returns the details of a table, but also a calculated value. What I'd like is for it to return this information to an entity that could contain this, whether it's the original entity, or an entity that's based on the original (so that if the original table changes, it will still map). What I'd like to avoid is maintaining 2 entities - 1 for the table, and 1 for the stored procedure results.

Thanks...

A: 

You could create a view that contained the table fields as well as the calculated values.

Shiraz Bhaiji
could u load the results of a SQL stored procedure into a view?
Tim Almond
Yes, but it is a bit of a hack using openrowset see: http://sqlblogcasts.com/blogs/madhivanan/archive/2007/11/26/select-columns-from-exec-procedure-name-is-this-possible.aspx
Shiraz Bhaiji
It would probably be better to move the functionality from the stored procedure into the view
Shiraz Bhaiji