Missing a cast


the error "cannot implicitly convert type 'system.linq.iqueryable<system.collections.generic.list<dynamic>>' 'system.collections.generic.list<dynamic>'. explicit conversion exists (are missing cast?)".

code:

[operationcontract]         [webget(uritemplate = "/{facilityid}/xs/metadata/", bodystyle = webmessagebodystyle.wrappedresponse, responseformat = webmessageformat.json)]         public list<dynamic> generatemetadata(string facilityid)         {             string url = operationcontext.current.endpointdispatcher.endpointaddress.uri.absoluteuri;             list<int> facilities = collectionutilities.convertcsvstringtointlist(facilityid);             xcontext.database.connection.connectionstring = dbutility.getconnectionstringforfacility(facilities, url);              var result = x in xcontext.xdetailrecords                     facilities.contains(x.facilityid)                     select new list<dynamic>{x.xidnumber,x.xpin,x.firstname,x.middlename,x.lastname};             return result;// return result.tolist() not working         }
help.


can expression "facilities.contains(x.facilityid)" true several items within xcontext.xdetailrecords? if not, have aggregate query result single or singleordefault. have 1 or none list result. otherwise several lists whereas function returns 1 list.

unfortunatelly not find c# pendant vb's "aggregate...into singleordefault" linq keywords, call .singleordefault on whole linq expression set in brackets.


armin



Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

BizTalk Server 2013 Azure VM Log Shipping and HA for hosts

How to Share webservice object to all user