Casting Store procedure result to custom property name.

#386 · closed · 2 comments

View on GitHub ↗

Thejas007

Hi , I was trying to cast store procedure result say First_Name to my model property FirstName. var db=Database.Open(); var results=db.CustomerDetails().ToList<UserModel>; // db.CustomerDetails() is returning the result with column name First_Name. Is there any way to specify the column alias using As keyword?

Comments

BenMagyar

(Missed that this was a stored procedure). I believe that if you were to cast your call to a static object, it does strip the `_` from the string anyway when doing the casting, so the aliasing would not be necessary in that case. But aliasing a stored procedure is not supported from what I know, you could just alias it in the stored procedure though?

Thejas007

Thanks @BenMagyar . It will full fill my requirement up-to an extent .