c# - devart dc.ExecuteQuery returns Object not set to an instance of an object -


i've upgraded devart 7.5 , few functions not working properly. specifically, i've got function returns ienumerable:

protected ienumerable<budgettotals> gettotals(decimal groupid, decimal budgetid) {     using (ssinpatdatacontext dc = new ssinpatdatacontext())     {          object[] ids = new object[2] { groupid, budgetid };          string sqlstr = "..."          var query = dc.executequery<budgettotals>(sqlstr, ids);          return query;     } } 

to point works fine, , return variable "query" holds correct values.
the problem when calling gettotals object not set:

... var query = gettotals(grpid,bdgid); foreach(budgettotals bt in query) {     ... } 

now, when control reaches "in" in foreach instruction exception thrown message "object not set instance of object", puzzling me because

a) working fine and

b) object is set within gettotals funcion.


i work things around changing return value ienumerable budgettotals[], , returning query.toarray. tried , works. main issue here other functions return ienumerable.

before overhauling application, i'd understand why or causing difference in behaviour devart 6.3 7.5.

thanks in advance

when performing executequery method in 'gettotals' function, entity reader obtaining data opened current datacontext object (dc). after exiting 'using' block in "gettotals" function, datacontext object (dc) disposed , entity readers closed. thus, when trying read data in foreach statement, reader closed, , exception occurs (we have changed text of exception, more informative). jic: in older version there issues closing entity readers.


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -