datacontractserializer Questions

2

using System.IO; using System.Runtime.Serialization; using System.Xml; using System.Xml.Schema; using System.Xml.Serialization; namespace XmlTest { class TestClass : IXmlSerializable { public X...
Conscience asked 22/9, 2010 at 0:47

5

Solved

Is there an easy way to get DataContractSerializer to spit out formatted XML rather then one long string? I don't want to change the tags or content in any way, just have it add line breaks and ind...
Hypethral asked 10/4, 2009 at 22:56

2

How can I use a DataContractSurrogate for my WCF REST service (hosted using a WebServiceHostFactory)? I don't see a way of adding one and even if I add a custom IOperationBehavior, the WebServiceH...
Maiduguri asked 20/1, 2011 at 0:12

1

Solved

I have a ASP.NET MVC Web API controller that returns public IEnumerable<IMessage> Get() It throws exception that I need to register types that derive from IMessage in known types collection ...
Luciusluck asked 25/1, 2013 at 12:48

4

Solved

I am using a DataContractSerializer to serialize an object to XML. The main object is SecurityHolding with the namespace "http://personaltrading.test.com/" and contains a property called Amount tha...
Fetus asked 16/11, 2009 at 18:55

3

Solved

Given the following code, [DataContract] public class TestClass { [DataMember] public object _TestVariable; public TestClass(object value) { _TestVariable = value; } public void Save() {...
Toluol asked 7/4, 2011 at 7:19

1

Solved

I am using DataContractJsonSerializer to serialize my custom object to JSON. But i want to skip the data members whose values are null. If DataMember is null that node should not come in JSON strin...

3

Solved

I have these classes: [DataContract] public class ErrorBase {} [DataContract] public class FileMissingError: ErrorBase {} [DataContract] public class ResponseFileInquiry { [DataMember] public ...
Horseradish asked 24/2, 2010 at 20:58

3

I have been struggling for a few days with an issue with our WPF applications and I wonder if someone has come across this before and can help? The problem seems to boil down to the client generati...
Crider asked 11/10, 2012 at 9:3

1

Solved

I am trying to find the best way to conditionally include and remove properties from my datacontract serialization in my .net WebApi project. In my Api, I want to allow users to specify the fields ...

1

When I have the following classes and I try to serialize a ConcreteClass instance with DataContractSerializer.WriteObject(..) I get an InvalidDataContractException. public abstract class AbstractC...

3

Solved

In my web method, I get an object of some third party C# entity class. The entity class is nothing but the DataContract. This entity class is quite complex and has properties of various types, some...

3

Solved

I develop (rewrite onto WCF) a file parsing web service accepting string[] and returning ISection[] but actually this is a set of nested interfaces: namespace Project.Contracts // Project.Contract...
Thallus asked 30/6, 2012 at 8:26

1

Solved

I have a data class that is serialized with the DataContractSerializer. The class uses the [DataContract] attribute with no explicit Namespace declaration. As such, the namespace in the resulting x...
Skiplane asked 18/6, 2012 at 23:0

3

Solved

MVC3 comes out of the box with JsonValueProviderFactory() which is very handy for binding incoming JSON to a model. Unfortunately, I can't figure out how to setup model contracts with names that di...

2

I am using DataContractSerializer to serialize an object to XML using DataMember attribute (only public properties are serialized). Is it possible to dynamically ignore some properties so that they...
Mafala asked 10/5, 2012 at 7:3

2

I understand what is the attribute property IsReference and what it is doing. But I don't understand why/when I should not use it. When is it a bad idea to use IsReference=true? If my wcf service ...
Lintwhite asked 16/1, 2012 at 7:7

2

Solved

I'm planning to build a WCFservice that returns generic dictionary objects serialized to JSON. Unfortunately, serialization fails, as object is potentially always different. KnownTypes can't help, ...
Zoolatry asked 26/4, 2012 at 11:6

4

Solved

I am currently trying to serialize a List, it serializes (I think fine), but when it deserialize, Sorry for the amount of code, but I am really stuck and have no idea why this is happening, i als...
Glum asked 9/2, 2011 at 22:55

2

Solved

I have a class that is effectively a object based enum. There is a static set of objects exposed by the class, and everything uses these same instances. eg (Note the private constructor) [DataCont...
Brunella asked 11/4, 2012 at 11:1

1

I am having issues specifying the dataContractSerializer maxItemsInObjectGraph in host's web.config. <behaviors> <serviceBehaviors> <behavior name="beSetting"> <serviceMe...

2

Solved

I am baffled with the behavior of the DataContractSerializer. Our configuration is XML based. XML is used as source for DataContractSerializer.ReadObject method. Recently I have encountered a probl...
Halsted asked 20/3, 2012 at 22:46

2

I have a struct in C# that wraps a guid. I'm using DataContractJsonSerializer to serialize an object containing an instance of that class. When I was using a guid directly, it was serialized as a p...
Klarrisa asked 24/7, 2009 at 14:59

1

in my Silverlight 4 application, I Serialize/Deserialize data with DataContractSerializer. I can have two different types of data: The EditorModel and the ConfiguratorModel. Both models inherit fro...
Catachresis asked 2/12, 2011 at 10:51

2

Solved

How do I remove XML namespaces from an object's XML representation serialized using DataContractSerializer? That object needs to be serialized to a very simple output XML. Latest & greatest ...

© 2022 - 2024 — McMap. All rights reserved.