serialization

Is it safe to serialize a raw boost::variant?

boost::variant claims that it is a value type. Does this mean that it's safe to simply write out the raw representation of a boost::variant and load it back later, as long as it only contains POD types? Assume that it will be reloaded by code compiled by the same compiler, and same version of boost, on the same architecture. Also, (prob...

Serializing an object but none of its references c#

Hi, I have a situation where I need to serialize an object but don't want to serialize any of its references. This is because I don't know in advance which dlls the object might be referencing and therefore can't ensure that they are serializable objects. This has arisen from needing to serialise plugins to preserve their state. Am I r...

C# XMl Serialization Question

I have a class that is serializing very nicely - finally! Now I want to add a property to this class, that I don't want to be serialized at all. Is it possible to add this new property with some kind of attribute so that when I call serialize or deserialize methods, this property will go unnoticed? Thank you ...

C# Serialization, attribute to strong type property

I have the following xml snippet: <Configuration> <Config name="SendToAddresses"></Config> <Config name="CCToAddresses"></Config> <Config name="BCCAddresses"></Config> </Configuration> What I would like is to deSerialize to a strongly typed class, with all items of config in an array containing value pair (name|value). T...

Skipping chosen types in ruby yaml serialisation

I'm serialising some object using YAML::dump(). Unfortunately that includes some elements that shouldn't be serialised, like locks with waiting threads sometimes. Is there any way to exclude selected types from serialisation, or force them to be serialised as an empty object instead? ...

Java Enums: de-serializing an arbitrary enum from a file

A co-worker ran into an interesting issue today, and while I think the actual, big-picture answer is "the fact that we're having this problem means we're doing something wrong", I figured I'd ask this anyway. Given the following: public class CrazyEnumTest { public class EnumeratedThing<T extends Enum<T>> { public T myValue; ...

Can I make the default collection editor and/or a custom UIEditor envoke the set accessor for a property?

I'm writing a plug-in for an application where I have a custom class that attributes the native objects of the program. The API allows me to read and write keyed strings directly to and from the objects in the native file. So rather then reading and writing to private fields in the Get and Set accessors of each property I'm reading and w...

Serialize C# class directly to SQL server?

Hi there, can anyone suggest the best way to serialize data (a class actually) to a DB? I am using SQL server 2008 but i presume i need to serialize the class to a string / or other data type before storing in the database? I presume that this field needs to be text or binary?? Does SQL server 2008 (or .net 3.5) support serializing d...

What are the issues with non-static inner classes and serialization in Java

This morning my boss and I had a long and ultimately fruitless discussion about this, in the context of trying to diagnose performance problems with a web application. We didn't really come to any conclusions. I think we're right in thinking that Serializable non-static inner classes have issues, but we're not sure precisely what the i...

Serialize a .Net SqlTransaction?

We have an interesting setup where we have SqlTransactions persisted to Application memory on a web application. We're looking into moving our web application into an NLB scenario, so we need a way for those Transactions to not be tied to a single machine's memory. Is there any way we can accomplish this..I've tried serializing a SqlTran...

Literate LINQ-to-XML: Best practice to deserialize attribute/value to structured variable/value pairs.

Hello everyone. I'm wrestling to deserialize the following XML: <?xml version="1.0" encoding="utf-8" ?> <conf name="settings"> <item name="lorem" one="the" two="quick" three="brown" four="fox" five="jumps" six="over" seven="the" eight="lazy" nine="dog" /> <item name="ipsum" ...

Please explain this SerializationException to me.

The simple class below inherits from HashSet and thus has to implement the ISerialization members (in a non standard way). I get the following Exception when I try to serialize then deserialize an instance of Group: Test method UtilitiesTests.GroupTest.SerializeTest threw exception: System.Reflection.TargetInvocationException:...

How to list all class properties

I have class SomeClass with properties. For example id and name: class SomeClass(object): def __init__(self): self.__id = None self.__name = None def get_id(self): return self.__id def set_id(self, value): self.__id = value def get_name(self): return self.__name def set_nam...

WCF - Sub-class added to a [DataMember] List<BaseClass> causes exception

One of my [DataContract] classes contains a [DataMember] which is a List. BaseClass has a few different sub-classes. Whenever that List contains instances of any sub-class, an exception occurs during/after the Service is returning to the request channel. If the List does not contain any sub-classes, it works fine. Here is an example of...

Serializing an ASP.NET web form

Is it possible to serialize an ASP.NET web form, including all data that a user has entered? I want to give the users the ability to save a half-completed form and was hoping I could accomplish this with serialization. Any simple examples would be greatly appreciated. Edit: I want to avoid having to have separate data layer for the "i...

how to serialize and deserialize static member

hi, i have a static dicitionary in my class which hold 12000 values. when i try to save my class i need to refresh the static dictionary, i mean i need to add some data in Static Dicitionary at server side. the problem is that after adding the values into Static Dicitionary ,it still retains 12000 values, not 12001(the last one doesn't ...

DeSerialization doesn't work though i Implement GetObjectData method and Constructor

Hi, I have a static generic dictionary in a class. As static memeber cannot serialized so i have implented ISerializable interface and method GetObjectData to serialize. I have a constructor which will also accept SerializationInfo and StreamingContext to deserliaze the dictionay. Now when i try to serialize and deserialize , it always...

Serializing an object into the body of a WCF request using webHttpBinding

I have a WCF service exposed with a webHttpBinding endpoint. [OperationContract(IsOneWay = true)] [WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare, UriTemplate = "/?action=DoSomething&v1={value1}&v2={value2}")] void DoSomething(string value1, string value2, MySimpleObject ...

Javascript serialization of DateTime in asp.net is not giving a javascript date object?

When I parse a DateTime to json in .Net it returns a string (i.e. "\/Date(1249335194272)\/"). How do I make it return a js Date object constructor not wrap in a string? // js server code var dteNow = <%= jsonDateNow %>; // js rendered code var dteNow = "\/Date(1249335477787)\/"; // C# using System; using System.Collections.Generic; ...

WCF deserialization issue

I'm having a problem with setting up a WCF web service integration with a 3rd party. It appears that it's not correctly deserializing the response object, I'm just getting a null from the web service call. The 3rd party is using this web service framework, which has a large set of abstract and complex types for performing simple operat...