serialization

traversing object graph from n-tier client

[亡魂溺海] 提交于 2020-01-01 03:53:06
问题 I'm a student currently dabbling in a .Net n-tier app that uses Nhibernate+WCF+WPF. One of the things that is done quite terribly is object graph serialisation, In fact it isn't done at all, currently associations are ignored and we are using DTOs everywhere. As far as I can tell one method to proceed is to predefine which objects and collections should be loaded and serialised to go across the wire, thus being able to present some associations to the client, however this seems limited,

flink - using dagger injections - not serializable?

三世轮回 提交于 2020-01-01 02:56:12
问题 Im using Flink (latest via git) to stream from kafka to cassandra. To ease unit testing Im adding dependency injection via Dagger. The ObjectGraph seems to be setting itself up properly but the 'inner objects' are being flagged as 'not serializable' by Flink. If I include these objects directly they work - so what's the difference? Class in question implements MapFunction and @Inject a module for cassandra and one for reading config files. Is there a way to build this so I can use late

Protobuf-net object reference deserialization using Dictionary: A reference-tracked object changed reference during deserialization

对着背影说爱祢 提交于 2020-01-01 02:41:15
问题 I'm having some issues trying to serialize/deserialize a complex object graph using protobuf-net. I'm working on a legacy application and we're using .Net Remoting to connect a GUI client to a C# service. We are seeing poor performance with overseas users due to the serialized size of our object graphs using the default BinaryFormatter , which is exacerbated by the limited bandwidth in-between the client and server (1Mbit/s). As a quick win, I thought I'd put together a proof of concept to

Is a deserialised object the same instance as the original

纵然是瞬间 提交于 2020-01-01 01:16:10
问题 When I instantiate an object from a class, an object is saved in the java heap. When I save the object by serializing it and I later deserialize the object, do I understand correctly that the object will now have a new heap address but will still be the EXACT SAME instance of the class. 回答1: The answer to your question cannot be just a yes or no. To analyze the concept is required. I will suggest you to take a pencil and paper and do it yourself keeping the below points in mind. All java

How to instruct Jackson to serialize a field inside an Object instead of the Object it self?

和自甴很熟 提交于 2020-01-01 01:13:24
问题 I have an Item class. There's an itemType field inside of that class which is of type ItemType. roughly, something like this. class Item { int id; ItemType itemType; } class ItemType { String name; int somethingElse; } When I am serializing an object of type Item using Jackson ObjectMapper , it serializes the object ItemType as a sub-object. Which is expected, but not what I want. { "id": 4, "itemType": { "name": "Coupon", "somethingElse": 1 } } What I would like to do is to show the itemType

C# and F# lambda expressions code generation

ⅰ亾dé卋堺 提交于 2019-12-31 17:53:55
问题 Let's look at the code, generated by F# for simple function: let map_add valueToAdd xs = xs |> Seq.map (fun x -> x + valueToAdd) The generated code for lambda expression (instance of F# functional value) will looks like this: [Serializable] internal class map_add@3 : FSharpFunc<int, int> { public int valueToAdd; internal map_add@3(int valueToAdd) { this.valueToAdd = valueToAdd; } public override int Invoke(int x) { return (x + this.valueToAdd); } } And look at nearly the same C# code: using

C# and F# lambda expressions code generation

ぐ巨炮叔叔 提交于 2019-12-31 17:53:27
问题 Let's look at the code, generated by F# for simple function: let map_add valueToAdd xs = xs |> Seq.map (fun x -> x + valueToAdd) The generated code for lambda expression (instance of F# functional value) will looks like this: [Serializable] internal class map_add@3 : FSharpFunc<int, int> { public int valueToAdd; internal map_add@3(int valueToAdd) { this.valueToAdd = valueToAdd; } public override int Invoke(int x) { return (x + this.valueToAdd); } } And look at nearly the same C# code: using

.NET XML Serialization and inheritance

痞子三分冷 提交于 2019-12-31 17:14:34
问题 I have structure like this: public interface A { public void method(); } public class B : A { } public class C : A { } List<A> list; List contains objects of type B and C they also have some fields that I would like to keep, can I now serialize it, deserialize back and get the proper object instances? Preferably to XML EDIT: Is there any simple way to serialize this list that contains interfaces, and then deserialize it back to B and C instances? 回答1: You may try using DataContractSerializer:

Caching downloaded JSON data to SQLite database - is it a good idea?

ε祈祈猫儿з 提交于 2019-12-31 13:15:13
问题 In my app I have to download JSON data from numerous web services. The data classes I use are fairly complex ones (lots of properties, quite deep inheritance tree, etc.). I intend to do caching, using a single db table, where I'd store the downloaded JSON data in a VARCHAR column (along with other meta-data containing columns). JSON serialization is being done with the Gson library. It seems quite convenient to just dump the instances into JSON, and parse them again later when I need them. No

Caching downloaded JSON data to SQLite database - is it a good idea?

こ雲淡風輕ζ 提交于 2019-12-31 13:15:07
问题 In my app I have to download JSON data from numerous web services. The data classes I use are fairly complex ones (lots of properties, quite deep inheritance tree, etc.). I intend to do caching, using a single db table, where I'd store the downloaded JSON data in a VARCHAR column (along with other meta-data containing columns). JSON serialization is being done with the Gson library. It seems quite convenient to just dump the instances into JSON, and parse them again later when I need them. No