I have the following classes:
[Serializable]
[DataContract(Name = "LayerInfo", Namespace = "ems.gis")]
public abstract class LayerPersistInfo
{
public LayerPersistInfo() { }
public LayerPersistInfo(int index, MappingContextBase context)
{
Index = index;
Context = context;
}
[DataMember(Name=...
Just imagine you have the following class
[DataContract]
public class NamedList
{
[DataMember]
public string Name { get; set; }
[DataMember]
public IList<string> Items { get; private set; }
public DumpList(string name)
{
Name = name;
Items = new List<string>();
}
}
If you serialize this in...
I'm seeing some unusual behavior when using the DataContractSerializer. I have defined a message contract like so:
namespace MyNamespace.DataContracts
{
[MessageContract(WrapperName = "order", WrapperNamespace = @"http://example.com/v1/order")]
public class MyOrder
{
[MessageBodyMember(Namespace = @"http://example.com/v1/order", Ord...
I've given a fair read through msdn:datacontracts and I cannot find a out why the following does not work. So what is wrong here? Why isn't ExtendedCanadianAddress recognized by the datacontract serializer?
Type 'XYZ.ExtendedCanadianAddress' with data contract name 'CanadianAddress:http://tempuri.org/Common/Types' is not expected.
Add ...
I have a problem with WCF deserialization where the client hangs on the response for more than a minute.
I'd like to try to swap different deserializers and see if it affects the behavior.
Can I swap in/out different serializers (are there any others?) from configuration, and if so can I do that with any binding, or is that out of cont...
I have the following data contract:
[CollectionDataContract(Name="MyStuff")]
public class MyStuff : Collection<object> {}
[DataContract(Name = "Type1")]
[KnownType(typeof(Type1))]
public class Type1
{
[DataMember(Name = "memberId")] public int Id { get; set; }
}
[DataContract(Name = "Type2")]
[KnownType(typeof(Type2))]
public cla...
I'm a little inexperienced with the DataContract paradigm, and I'm running into a deserialization problem. I have a field that's a string, but it contains xml and it's not being deserialized correctly. I have a feeling that it's because the DCS is treating it as input to the serializer and not as an opaque string object.
Is there some w...
i am using third party classes in my service, so i cant edit them.
third party
[Serializable]
Class B : E
[Serialazable]
Class E : A
service
[ServiceKnownType(typeof(B))]
[ServiceKnownType(typeof(E))]
fun(A pic)
client
for some reason :
proxy.fun(object)
throw an exception that B is unexpected and add it to ...
I created and love my Asp.Net MVC2 application. It's a very nice DDD app with Domain Model classes, View Model classes, a repository, and Json action methods to expose data.
My coworker wants to share my data with his Asp.Net Forms based C# code. He wants to pull through the Internet a class definition (like a Data Contract), then fil...
Basically I want to have a single construct to deal with serializing to both JSON and formatted xml. Records worked nicely for serializing to/from json. However XmlSerializer requires a parameterless construtor. I don't really want to have to go through the exercise of building class objects for these constructs (principle only). I w...
In our production environment, our WCF services are serialized with the XMLSerializer. To do so our service interfaces have the [XMLSerializerFormat] attribute. Now, we need to change to DataContractSerializer but we must stay compatible with our existing clients. Therefore, we have to expose each service with both serializers.
We have ...
I am having issues specifying the dataContractSerializer maxItemsInObjectGraph in host's web.config.
<behaviors>
<serviceBehaviors>
<behavior name="beSetting">
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="True" />
<dataContractSerializer maxItemsInObjectGraph="214748364...
Hello,
I'm having trouble serializing an immutable instance with the DataContractSerializer, since the properties on the class I'm serializing is missing setters. The problem is that I only want to serialize the instance (just so it can be written to a log), and I will never need to deserialize it. Is there a way to bypass this behavior...
I'm using DataContractSerializer to serialize a class with DataContract and DataMember attributes to an XML file. My class could potentially change later, and thus the format of the serialized files could also change. I'd like to tag the files I'm saving with a version number so I at least know what version each file is from. I'm still d...
Hi,
I'm currently using wrapper classes for my DataSets ,in order to implement custom serialization. I would like to use DataContractSerializer (more like have to use it) but still support the custom serialization. The problem is that the [DataContract] and [Serializable] attributes don't seem to get along so well... how could I override...
I'm trying to use the geocoding code from here in my ASP.NET MVC 2 site. Unfortunately, some of that code, specifically the DataContractJsonSerializer usage, is only possible through .NET 4.0. As my hosting provider doesn't support .NET 4, I'm forced to implement that functionality in .NET 3.5.
How can I rework the code (which I have re...
Hi
My problem is that I would like to use the CollectionDataControlAttribute to deserialise a collection which does not have a group element. The xml looks something like this:
<RootElement>
<SomeProperty />
<ListElementEntry />
<ListElementEntry />
<ListElementEntry />
<ListElementEntry />
</RootElement>
Where Li...
Hi All,
I had a quick question regarding the datacontractserializer. Maybe it's more of a stream question. I found a piece of code that writes the xml to a filestream. I basically don't want the file and just need the string output.
public static string DataContractSerializeObject<T>(T objectToSerialize)
{
var fs = new ...
Is it possible that DataContractSerializer wrongly deserializes object if fields are not in the "correct" (whatever that means) order? My classes that I serialize/deserialize do not have order attributes placed on fields/properties. Yet one of my fields always get deserialized as null although it has values, it actually contains a list o...
I have a service. I have an existing class of business objects. What I would like to know is how can I pass a class through WCF from the business object assembly without having to create a new class in my WCF site while appending or tags?
Here is an existing UDT:
Namespace example: Application.BusinessObjects.Appointments
Public St...