datacontractserializer Questions

4

Solved

Is there a way to change how the DataContractJsonSerializer serializes dates? Currently, it'll convert a date to something like: { "date": "/Date(1260597600000-0600)/" } I would rather have it...
Brentwood asked 6/10, 2011 at 0:8

5

Solved

I have the following 2 functions: public static string Serialize(object obj) { DataContractSerializer serializer = new DataContractSerializer(obj.GetType()); MemoryStream memoryStream = new Memor...
Limemann asked 15/2, 2011 at 22:20

8

I am very confused about the DataContract attribute in WCF. As per my knowledge it is used for serializating user defined type like classes. I wrote one class which is exposed at client side like t...
Nakitanalani asked 29/1, 2011 at 11:49

5

Solved

I just realized something crazy, which I assumed to be completely impossible : when deserializing an object, the DataContractSerializer doesn't call the constructor ! Take this class, for instance...

9

Solved

I have some class that I'm passing as a result of a service method, and that class has a get-only property: [DataContract] public class ErrorBase { [DataMember] public virtual string Message { g...
Howitzer asked 24/2, 2010 at 2:29

3

When I call a web service operation, WCF deserializes the message to the proxy class with the DataContractSerializer: why couldn't I do the same ? Here is the soap message in the file ActLoginResp...
Precipitous asked 2/5, 2017 at 15:22

3

Solved

I'm looking for a way with C# which I can serialize a class into XML and add a namespace, but define the prefix which that namespace will use. Ultimately I'm trying to generate the following XML: ...

3

To get more control over serialization, I have converted a class from [DataContract] to [Serializable], implementing both GetObjectData and the special deserializing constructor. When I do this, th...
Jewbaiting asked 2/4, 2009 at 17:26

3

Solved

In a WCF 4.0 service we receive a huge amount of data in a generic list. This list object graph is bigger than the 65536 default limit. We are quite used to it, so we have configured the service fo...
Agglomeration asked 8/2, 2012 at 10:6

1

Solved

Since XmlSerializer can not serialize any other properties when the class is inherited from List <>, I try to solve them with the DataContractSerializer. This should work, as described here: ...
Surprisal asked 22/3, 2019 at 14:29

3

Solved

I'm using DataContractSerializer to serialize an object that contains a Dictionary<string,object> member, which is marked with [DataMember()]. The idea is to have a flexible bag of object att...
Larcenous asked 1/10, 2011 at 14:5

3

Solved

I've found numerous solutions here at SO and elsewere that deal with deep clone of object via serialization/deserialization (into memory and back). It requires that classes to be cloned are marked...
Dorinda asked 19/1, 2012 at 23:47

6

Solved

I have a smart client application communicating with its server via WCF. Data is created on the client and then sent over the service to be persisted. The server and client use the same domain clas...
Gaye asked 5/8, 2011 at 20:58

2

Solved

Problem: I have a WCF service setup to be an endpoint for a call from an external system. The call is sending plain xml. I am testing the system by sending calls into the service from Fiddler usin...
Torrlow asked 25/3, 2010 at 20:46

2

Solved

I have a large third party webservice; the reference.cs is 33 Mbyte. Using Visual Studio 2017, the proxy uses the XML Serializer, which causes a 5 second delay when creating the channel. I opened a...
Weave asked 19/6, 2017 at 18:11

3

Solved

Trying to make a serializable class in ASP.NET vNext Class Library Project. Not able to give my class items [DataContract] or [DataMember] Attributes. As I just started exploring vNext so I am litt...

1

Solved

I had a problem that my object wasn't being deserialized from the Post request's body, and I followed this answer which states because DataContractSerializer is used by default in WebApi, you need ...
Tantalous asked 27/3, 2017 at 16:29

1

Let me preface by saying I'm fairly new to WCF, and might be using the wrong terminology throughout here. My project has two components: A DLL containing the classes for Attachment, Extension, Re...
Episcopalism asked 16/7, 2013 at 14:30

7

Solved

I'm refactoring my XML-serialization, and figured I'd try the DataContractSerializer. Everything runs smoothly, until it needs to serialize this class: using System; using System.Runtime.Serializa...

4

I have 2 classes [DataContract, KnownType(typeof(B))] public class A { [DataMember] public string prop1 { get; set; } [DataMember] public string prop2 { get; set; } [DataMember] public strin...
Whey asked 21/9, 2016 at 10:27

2

Solved

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 late...

3

Google protobuf is great protocol to serialize objects efficient, but it only supports serialization of trees, not graphs (lack of full Object Reference Tracking). There are few implementation of ...

2

I'm using XmlDictionaryWriter to serialize objects to a database with data contract serializer. It works great, both size and speed are 2 times better then using text/xml. However, I'll have to de...
Autostability asked 14/3, 2011 at 18:55

2

Solved

I'm using web service to get data about route mileage. Then I'm using deserializer to parse it out. Here is how JSON looks: [{"__type":"CalculateMilesReport:http:\/\/pcmiler.alk.com\/APIs\/v1.0","...

1

Solved

I have a DateTime datamember in a datacontract. By default the datacontractserializer serializes the UTC time to yyyy-MM-ddTHH:mm:ss.fffffffZ format. I need it in yyyy-MM-ddTHH:mm:ss.000Z format bu...
Assessment asked 8/12, 2015 at 23:2

© 2022 - 2024 — McMap. All rights reserved.