1. Thomas Rolseth
  2. SnapDevelop
  3. Tuesday, 23 June 2020 19:16 PM UTC

We are replacing instances of the deprecated SelectToStore() method in our web api.  In the code below (line 2) we switched 'SelectToStore' to 'Select'.  However, we now get an error on the last line.  The error is attached.  What is the proper syntax for that last line to add the select result to the datapacker object?

This is with SnapDevelop 2019 R2 build 2323 and an Oracle database on Windows 10.

mr_packer = new DataPacker();

var result_rcv_select_mr_info_pcr61 = _dataContext.SqlExecutor.Select<DynamicModel(sql_rcv_select_mr_info_pcr61, mr_id_inp);
           
mr_packer.AddModelStore<DynamicModel>("mr_info_pcr61", result_rcv_select_mr_info_pcr61);

Attachments (1)
Accepted Answer
Logan Liu @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 24 June 2020 17:09 PM UTC
  2. SnapDevelop
  3. # Permalink

Hi Tom,

I would like to use the DataPacker.AddModels<TModel>() method at first, but it hasn't supported DynamicModel model type yet.

Therefore, please use the DataPacker.AddRaw() method to work around it.

var dataContext = new SqlServerDataContext(new SqlServerDataContextOptions(connStr));

string sql = "select * from Product where ProductID > 0";

var list = dataContext.SqlExecutor.Select<DynamicModel>(sql);

DataPacker dataPacker = new DataPacker();

var json = list.ToJsonString();

dataPacker.AddRaw("jsonKey", json);

return dataPacker;

BTW: You can also submit a bug on our standard support portal (at http://www.appeon.com/standardsupport) to track it.

Regards,

Logan

Comment
  1. Thomas Rolseth
  2. Friday, 26 June 2020 19:23 PM UTC
Thanks Logan!
  1. Helpful
There are no comments made yet.


There are replies in this question but you are not allowed to view the replies from this question.