score:3

Accepted answer

do you mean this?

getorderlistdatacontext orderlistdactx = new getorderlistdatacontext(address);
var orderlist = from order in orderlistdactx.base_purchase_getorderlistbyuser_ws(request.userguid, request.countrycode, request.fromdate, request.todate)
select new order{
         orderkey = order.orderkey,
         useremail = order.useremail,
         createddate = order.createddate
}

return orderlist.tolist();

score:0

see linq error:

could not find an implementation of the query pattern for source type 'your.type'. 'select' not found. consider explicitly specifying the type of the range variable

it's likely that orderlistdactx.base_purchase_getorderlistbyuser_ws(request.userguid, request.countrycode, request.fromdate, request.todate) returns type 'ienumerable', but the linq requires ienumerable<t>. you have to perform explicit cast:

var orderlist = from order order in orderlistdactx.base_purchase_getorderlistbyuser_ws(request.userguid, request.countrycode, request.fromdate, request.todate)
                select order;

i assume, that that base_purchase_getorderlistbyuser_ws returns collection of order.

score:1

you can just chain:

var orders = orderlistdactx.base_purchase_getorderlistbyuser_ws(request.userguid, request.countrycode, request.fromdate, request.todate)
                           .select(order => new order
                             {
                               orderkey = order.orderkey,
                               useremail = order.useremail,
                               createddate = order.createddate
                             })
                           .tolist();
return orders;

score:1

this line showing compiler error could not find implementation of query pattern for source type int select not found

you main problem is from your stored procedure. refer: linq stored procedure issue- returning an int


Related Query