markrendle / Simple.Data

A light-weight, dynamic data access component for C# 4.0
MIT License
1.33k stars 303 forks source link

Casting Store procedure result to custom property name. #386

Closed Thejas007 closed 8 years ago

Thejas007 commented 8 years ago

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; // db.CustomerDetails() is returning the result with column name First_Name.

Is there any way to specify the column alias using As keyword?

BenMagyar commented 8 years ago

(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 commented 8 years ago

Thanks @BenMagyar .

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