Questions tagged [netdatacontractserializer]
44 questions
16
votes
5 answers
Transferring large payloads of data (Serialized Objects) using wsHttp in WCF with message security
I have a case where I need to transfer large amounts of serialized object graphs (via NetDataContractSerializer) using WCF using wsHttp. I'm using message security and would like to continue to do so. Using this setup I would like to transfer…

jpierson
- 16,435
- 14
- 105
- 149
14
votes
8 answers
Modify the xml array element name in serialized ASP.NET WebAPI object
I have been struggling with outputting a custom root xml element when returning a list of objects in my WebAPI controller.
My controller method looks something like this:
public List Get()
{
return repository.GetProducts();
…

heidgert
- 451
- 4
- 6
10
votes
1 answer
NetDataContractSerializer vs DataContractSerializer
We have an application with objects that we'd like to keep serialized in the database.
Currently we're using NetDataContractSerializer, but recently found out that due to the .Net types information involved, it creates huge files which means slow…

Noich
- 14,631
- 15
- 62
- 90
8
votes
1 answer
Optional properties when deserializing a DataContract/Serializable mish-mash
I have an existing codebase that persists a couple of simple classes to disk via NetDataContractSerializer, but the classes are unfortunately not adorned with [DataContract], but rather with [Serializable]. This works fine, but now I want to add a…

Avner Shahar-Kashtan
- 14,492
- 3
- 37
- 63
8
votes
4 answers
C# DataContract Serialization, how to deserialize to already existing instance
I have a class, which holds a static dictionary of all existing instances, which are defined at compile time.
Basically it looks like this:
[DataContract]
class Foo
{
private static Dictionary instances = new Dictionary();
…

Stefan Steinegger
- 63,782
- 15
- 129
- 193
7
votes
0 answers
NetDataContractSerializer and WCF
I have a scenario where I need to use the NetDataContractSerializer instead of the DataContractSerializer.
Up until now I have been using this method - http://www.pluralsight.com/community/blogs/aaron/archive/2006/04/21/22284.aspx - which appears…

vdh_ant
- 12,720
- 13
- 66
- 86
6
votes
2 answers
Avoiding using the “http://www.w3.org/2001/XMLSchema-instance” namespace with .Net DataContractSerializer
I have a series of classes that I am converting to XML using .NET's DataContractSerializer in .NET 4.0. The serialisation is working fine, and I can parse the XML and recreate the .NET objects later without any difficulty.
However, most of the…

Michael Shaw
- 604
- 7
- 15
5
votes
1 answer
Problem deserializing with NetDataContractSerializer after refactoring code
I have a situation where I'm serializing some .NET objects using NetDataContractSerializer and storing the XML in a database as a way to remember the state of these objects within an application. Recently I just came across the first situation where…

jpierson
- 16,435
- 14
- 105
- 149
4
votes
1 answer
F# DataContractJsonSerializer StackOverflowException
dataElementsList : TypesAndData.DataElement list
is a list of 50,000 records (actually many more but let's start small). I am trying to serialize to a JSON file:
let ser = Json.DataContractJsonSerializer(typeof)
use…

akaphenom
- 6,728
- 10
- 59
- 109
4
votes
1 answer
Does the compact framework 3.5 support System.Runtime.Serialization?
I am writing a library which is a set of classes meant to be shared between many different .NET applications, including at least one which uses the .NET compact framework. I have been making these classes use the [DataContract] attribute with a…

Los Frijoles
- 4,771
- 5
- 30
- 49
3
votes
1 answer
NetDataContractSerializer and assembly versions mismatch
I'm using NetDataContractSerializer to exchange data among applications. I would like the ReadObject method throw an exception when assembly versions don't match.
Now, for example, when I serialized my object from assembly version 1.0.0.0 and later…

Valentin V
- 24,971
- 33
- 103
- 152
3
votes
1 answer
Empty String Serialization with Datacontracts
I have the most generic example of Serialization I can think of: a class with two variables and one instance of it, I would like to serialize.
However I have the problem that the code below always gets me an empty string. I run out of ideas why…

Salocin
- 393
- 6
- 17
3
votes
2 answers
Control object creation during deserialization
I would like to control object creation of a type that is not usually serializable during deserialization using a NetDataContractSerializer (or any serializer I guess). Using a custom SerializationBinder I can control the type that is constructed…

Andrew
- 413
- 3
- 11
3
votes
1 answer
NetDataContractSerializer Deserialization With New Property
Lacking any real foresight, I've serialized a large set of data decorated only with Serializable using NetDataContractSerializer, and now I'd like to add a new field. What are my options?
The original class looks something like this (with a few…

Gene
- 1,587
- 4
- 18
- 38
2
votes
0 answers
DataContractSerializer not serializing properties of custom collections
I've found similar questions from people about properties of objects within a collection, but my question is about a property of the collection itself. In the example below, the Something property of the Collection doesn't make the trip back from…

Chris Benard
- 3,167
- 2
- 29
- 35