![]() Imagine for example that the server has a simple Dictionary that dictionary has a string key and V is an IList, so contains multiple lists each with a 'name'. Why is there no support for this? It seems there is no real support for serializing Expression trees - a few attempts are on the web - but they appear buggy/alpha grade. The scenario here is that the server has all of the in-memory collections we need to query against and has all of the types etc too. Now imagine there is a client that has an Expression (as will be seen in the LINQ Provider's CreateQuery method) and wants to serialize this, send to server and wait for results before returning them. I'm just trying to grab as much of the Request object as possible while avoiding any of these types of mishaps.Imagine there is a server process that has all of the types needed to excute a LINQ query, enumerate results and send them back. I'm not opposed to simply avoiding serializing Stream objects and Circular References. ![]() My latest approach ( using the JSON.NET library) I thought would come close to working, however I encountered an error that involved a "Timeout" property on Stream objects within the Request. Using the JSON.NET library and trying to serialize it through the JsonConvert.SerializeObject() method ( I have tried to pass in several additional settings to avoid a circular reference, but haven't had any luck) ( This failed when encountering a circularĪttempting to store each of the Properties within a Dictionary object and then using JSON to serialize the entire Dictionary ( in hopes that it would "flatten" the object out and make it easier to serialize) Request and attempting to construct a JSON string ![]() Using Reflection to iterate through each of the properties within the I'll detail a few of the approaches that I have taken so far below to possibly find any areas that I may have gone wrong. I'm just curious if there is a better method of handling this ( or what the best method of handling it may be). These only occur when actually encountering properties that do contain a circular reference, as I have previously used the following code to grab just specific elements that I need : JSON.Encode(new ) However, I quickly found that this causes all sorts of circular references to be thrown ( primarily due to the actual structure and complexity of the Request object). I originally thought that I would be able to easily accomplish it using the JSON.Encode() method as seen below : JSON.Encode(HttpContext.Request) I'm currently working on a proof-of-concept and ran into an issue involving using JSON to serialize an HttpRequest. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |