Applying Dynamic LINQ on Azure table storage is thowing exception Value cannot be null -


im trying query azure table storage's table using dynamic linq queries subset of columns along dynamic constructed predicate. able generate predicate, implement select i.e. projection operation required properties/ columns entities of azure table i'm facing difficulties. sub set of columns i'm trying use dynamic linq library. here columns not predefined, columns can anything, user may select. these columns nothing properties of customer class..

months.asparallel().forall(x => rowkeys.asparallel().withdegreeofparallelism(5).forall(y =>             {                  string startrowkey = y.getrowkeystartfilter();                 string endrowkey = y.getrowkeyendfilter();                 datacontextexcisecustven rptcontextparallel = new datacontextexcisecustven();                 var strpredicate =     getpredicate(x.tostring(), startrowkey, endrowkey);                 iqueryable<dynamic> query = (rptcontextparallel.createquery<domaindata.entities.excise.invoice>(domaindata.entities.excise.invoice.table_name)                 .where(strpredicate)                 .select("new (partitionkey ,rowkey ,timestamp ,companycode,programcode)")) iqueryable<dynamic>;                 cloudtablequery<dynamic> dyn = query.astableservicequery();                 foreach (var z in dyn.execute())                 {                      threadsafedata.add(z);                  }              }           )); 

when execute above code, i'm getting exception @ query.astableservicequery();, value cannot null . select("new (col1,col2)") returns iqueryable type , not iqueryable. because i'm returning sub set of columns azure table, not know destination type of object. anonymous every time. iqueryable doesn't contain astableservicequery() extension method. iqueryable has extension method azure client sdk.

iqueryable<dynamic> query = (rptcontextparallel.createquery<customer>(domaindata.entities.customer.table_name)                 .where(strpredicate)                .select("new (companycode,programcode,customername,...)")) iqueryable<dynamic>; 

the above statement, select clause returns iqueryable type , type casted iqueryable because iqueryable doesn't contains astableservicequery extension method. typed cased iqueryable . cloudtablequery dyn = query.astableservicequery(); .. here throws exception has value cannot null. looks type casting failed. because of linq expression cannot evaluated. work around have iqueryable astableservicequery extension method.

i tried other way around , commented out statement // cloudtablequery dyn = query.astableservicequery(); , changed loop below, worked charm. foreach (var z in query) {} question, not using astableservicequery() , execute method of storage client. there side effects not calling astableservicequery. able receive data continuationtokens, or keys etc. result returns azure table around 1 million or more. above query can able retrieve records along other keys .

please me on this...


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -