Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. COoriginally, I did not encode and I returned cat. But on the browser side, I got error message: "ExceptionMessage":"The 'ObjectContent`1' type failed to serialize the response body for content type 'application/json;" ... so I tried to encode it like above. Then I didn't get the error msg but the returned now looked like above and I can't use the returned data in the callback like I normally would. Not sure if this matters, but I have my webAPI function as such: public dynamic Get(string filter) ... does the dynamic return type matter?
      singulars
    2. COwell, I tried something different and it works. But the call is super slow (4+ sec). In the webApi, I declare a List<string> list. Using Entity Framework, I call the store proc and I run the returned object through a foreach loop. For each item found, I add it to the "list". Then I return "list" (without any direct json encoding). This works but it is super slow. Is this a bad method to get data using JQuery using the .net webAPI to access a store proc to get data from a SQL Server?
      singulars
    3. COIf you're returning a `List<string>` from your API method then that is what you should declare as the return type of the method (`IEnumerable<string>` should also work). I would not make the return type `dynamic` when the type is known. Serializing a short list of strings should not be slow in and of itself. I do this all the time in my Web API code with no problems at all. Are you sure the performance problem isn't in your stored procedure or something else you're doing?
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload