serialization

Different behavior between 'Service Reference' and 'Web Reference'

I have WCF endpoint exposed as defined bellow, <service name="MyApp.Server.Endpoint.Orange" behaviorConfiguration="MyTio.Server.Endpoint.OrangeBehavior"> <endpoint address="" binding="basicHttpBinding" contract="Host.Server.Contract.IMyAppApi" bindingNamespace="http://host.com/myapp"&gt; <identity> <dns value="localhost"/> ...

Serializing a List hold an interface to XML

I have been reading around but I have not come across a solution to my problem I am currently working with a Business Object that will hold all my data and we need to convert this object to and from XML. My object holds a list of Actions (List...), but there are 2 action types (for now). I have to action types SimpleAction and Composit...

Django serialization of inherited model

Hi, I have a problem with serialization of Django inherited models. For example class Animal(models.Model): color = models.CharField(max_length=50) class Dog(Animal): name = models.CharField(max_length=50) ... # now I want to serialize Dog model with Animal inherited fields obviously included print serializers.serialize('xml',...

Django Model deserialization with empty PK

I've serialized my django model: serializers.serialize(MyModel.objects.filter(color="Red")) and got this output: <object model="example.example" pk="133"> <field name="name" type="CharField">John Smith</field> <field name="color" type="CharField">Red</field> ... #more fields </object> So you can see I have pk="133": An...

Deserialize from MemoryStream throws OutOfMemory exception in C#.

This is a C# 3.0 Winform problem. I want to clone a big(not very big actually), complicated object. To do it lazily, I seralize it to a MemoryStream and use BinaryFormatter.UnsafeDeserialize(MemoryStream, null) method to get the cloned object. Inside the UnsafeDeserialize() method, there is always an OutOfMemory exception thrown. The me...

Insert Java Object In Sql Server

Hi! How Can I Insert/Retrive A Java Object Into/From Sql Server? THX ...

Is it pointless to mark a class with no properties as Serializable?

I came across this code while working through code-analysis warnings on our code base. I want to change the name, but not if it will cause a serialization issue. While it looks to me like there is no point in it being serializable, I just wanted to check to make sure I'm not missing something before I strip the attribute. [Serializabl...

InvalidCastException when serializing and deserializing

I have this code: public byte[] SerializeToBlob() { using (var buffer = new MemoryStream()) { var formatter = new BinaryFormatter(); formatter.Serialize(buffer, this); buffer.Position = 0; return buffer.ToArray(); } } public static ActionData DeserializeFromBlob(byte[] state) { using (var...

How should I serialize some simple auditing data for storing in a SQL table?

I have an audit table in SQL server. It is to record an entry for each high-level user action, e.g. update a record, add a new record, delete a record etc. I have a mechanism for detecting and recording all the changes made (in .NET, not as a trigger in the database) and have a collection of objects that record a field name, previous va...

c# serialized data

I have been using BinaryFormatter to serialise data to disk but it doesn't seem very scalable. I've created a 200Mb data file but am unable to read it back in (End of Stream encountered before parsing was completed). It tries for about 30 minutes to deserialise and then gives up. This is on a fairly decent quad-cpu box with 8Gb RAM. I'm...

User settings XML serialization of an Object

I am trying to save a custom object as a user setting in a VB.net app. This object consists of a List(Of Pair(Of String, Object)). Pair is a custom class which has two read/write properties (a String and an Object). If I put simple types like int, string, datetime as the second value of my pair, the setting is saved without any problem....

.NET - JSON Data - Deserialization - Lists & Dictionaries

I need to pull back from a database JSON documents that are not based on a standard object. Is there a way using .NET to "deserialize" these documents into Lists & Dictionaries of primitive objects (string, int, bool, etc...) Any library that can do this in both directions? ...

XML Object Deserialization to Interface

I have two classes SccmAction and TicketAction which both implement interface IDelivery. These classes will be transmitted on a processing queue from which I just want to pull the message and act upon the Deliver method. It seems however that I cannot deserialize to an interface because when I attempt to do so a System.NotSupportedExcep...

Which serialization format for key/value pairs is best indexable in RDBMS?

I have a certain object type that is stored in a database. This type now gets additional information associated with it which will differ in structure among instances. Although for groups of instances the information will be identically structured, the structure will only be known at runtime and will change over time. I decided to just ...

Serializing json objects while calling ajax asp.net callback page

I'm using asp.net page that is fully ajaxified (with jquery lib) and calling another asp.net callback page to get/post data to server. Some users of my page experiencing following error when serializing json object there was an error deserializing the object of the type ... object type ... contains invalid utf8 bytes $.ajax({ ...

Serializing COM Interop Object using C#

Hi guys! I'm working in a WCF project and we need to reuse some legacy components from vb6. In the service, we need to mantain state for each user as we need to store one COM Interop object (per user) which is costly to construct. The project can grow in the future so it's possible we may need to use StateServer/SqlServer-based sessio...

Skipping rows of a typed dataset during WCF serialization

Hallo, I have a dataset with a datatable which is frequently transmitted via WCF (with NetMsmqBinding) to a service in order to store the changes in the database. In order to keep the message size small I would like to transmit only the changed records to the service (DataRow.RowState != Unchanged). I have tried to use the IDataContra...

What are the differences between the XmlSerializer and BinaryFormatter

I spent a good portion of time last week working on serialization. During that time I found many examples utilizing either the BinaryFormatter or XmlSerializer. Unfortunately, what I did not find were any examples comprehensively detailing the differences between the two. The genesis of my curiosity lies in why the BinaryFormatter is ab...

Storing Large Lookup Tables

I am developing an app that utilizes very large lookup tables to speed up mathematical computations. The largest of these tables is an int[] that has ~10 million entries. Not all of the lookup tables are int[]. For example, one is a Dictionary with ~200,000 entries. Currently, I generate each lookup table once (which takes several minute...

Feedback on code to Serialize, Deserialize and Save Image

Here is my code to Serialize, Deserialize and Save an image to the file system. I have looked at many examples of serialization/deserialization and I just want to get some feedback as I am sure my code could be improved. Any feedback would be greatly appreciated. I know this is a common problem so hopefully this question will be a good r...