netdatacontractserializer

NetDataContractSerializer and WCF

Hi guys 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 quite simple but according to this http://social.msdn.microsoft.com/forums/en-US...

Adding a DataMember to a different namespace to the DataContract

Hi With the XmlSerializer I can have my members in different namespaces to the parent type. Can I do the same thing with DataContractSerializer? I would like the following Xml <h:Type xmlns:h="http://schemas.e.com/WebServices" xmlns="http://schemas.e.com/WebServices"&gt; <Member xmlns="http://schemas.e.com/CoreTypes"&gt;0&lt;/Member...

Custom attribute to switch property serialization to NetDataContractSerializer

In .NET 3.5, I would like to create a custom attribute (say [NetDataMember]) that would switch the serialization behavior from DataContractSerializer to NetDataContractSerializer. Basically, for a class A as illustrated below [DataContract] class A { [DataMember] public int SimpleProperty { get; set; } [Transcient] public IBar...

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<long, Foo> instances = new Dictionary<long, Foo>(); [DataMember] private long id; public static readonly Foo A = Create(1); public s...

What are all these null collection entries in my DataContract XML?

Does anybody know why the NetDataContractSerializer might add "nil" entries in a serialized collection? For example, <Jobs z:Id="17"> <_items z:Id="18" z:Size="4"> <JobRecord z:Id="19"> <Name z:Id="20">Job1</Name> </JobRecord> <JobRecord i:nil="true" /> <JobRecord i:nil="true" /> <JobRecord ...

Selective serialization with NetDataContractSerializer

Serializing this class works fine. However, sometimes I'd like to exclude the field. Is this possible? [DataContract] class Foo { [DataMember] Foo _Foo; } Setting the field to null temporarily is impossible. ...

Is there a way to signalize an object its successful deserialization?

I'm using NetDataContractSerializer. After successfully deserializing an object, is there a way to tell the object to finish its construction? I'm thinking along the lines of: [DataContract] class Foo { [DataMember] int i; [SerializationCompletedEvent] void SerializationCompleted () { i = i + 7; } } ...

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<TypesAndData.DataElement list>) use ofs = File.OpenWrite(fileName) let result = ser.WriteObject(ofs, dataElementsList) an...

Discovering known types for DataContractSerializer in modular fashion in c#

I have a modular application built using the Unity container. Modules are registered in app.config but each module adds additional elements that are persisted as part of the user profile upon application shutdown. I want to be able to serialize any element into the user profile based on those modules currently loaded, as each module pro...

How to best transfer large payloads of data using wsHttp with 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 serialized object graph which can sometimes approach around 300MB or so but when I try to do so ...

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 and using a custom ISurrogateSelector and ISerializationSurrogate to control how state is se...

AppFabric cache and serializing IQueryable objects

Hello, I am experimenting with AppFabric caching and have run into an issue with saving retrieved data in the cache. The root of the problem is that it seems that AppFabric Caching requires the data to have DataContract and Datamember attributes applied to the class that is being saved. If that is the case, then how can I save this (si...