In VB.NET (using Visual Studio 2008) my WCF service has an interface something like:
<ServiceContract()> _
Public Interface IThingService
<OperationContract()> _
Function GetThingByNumber(ByVal thingNumber As MyKeyClass) As Thing
<OperationContract()> _
Function GetThing(ByVal thingId As Guid) As Thing
' ...
End Inter...
I'm upgrading a restful service, and am now using the DataContractSerializer to output the response. The previous version just used custom serialization w/ XmlSerializer. Because that version used attributes a lot, and DCS never does, I'm seeing that the new response size is 1.5x the size of the previous version when compressed with gz...
I'm using the following code to serialise an object:
public static string Serialise(IMessageSerializer messageSerializer, DelayMessage message)
{
using (var stream = new MemoryStream())
{
messageSerializer.Serialize(new[] { message }, stream);
return Encoding.UTF8.GetString(stream.ToArray());
}
}
Unfortuna...
I have a 3.5 SP1 project, WCF service which is limited to consumption by Silverlight 3 clients. Due to the business requirements we have to work with large object graphs that are hydrated via SQL Server on the WCF side and then sent to the Silverlight client. They are deep, you might have a class that has two collection properties and ea...
I'm working on getting some objects serialized through an mvc site and returning things via xml, json, etc and I'm looking for the best way to not send the empty elements.
In a perfect world, simply attaching EmitDefaultValue:=False to DataMembers in a DataContract would suffice, but in some situations, it just doesn't fly.
A String de...
I'm looking for a way to persist Silverlight objects to a user's PC, then re-hydrate them so the user can finish editing them.
Serialising with DataContractSerializer and persisting to IsolatedStorageFile works fine. However, deserialising causes a problem. Here's the code that causes the failure:
private string _FirstNames = string.E...
Because of performance tuning I would like to return only necessary properties. Is there a possibility/workaround? Pseudo / sample code to understand:
[DataContract]
public interface IMemberOverview
{
[DataMember]
public int Id { get; set; }
[DataMember]
public string Name { get; set; }
}
[DataContract]
public interfac...
When deserializing, DataContractSerializer requires not only that an element name matches, but also that it is in a certain order with respect to the other elements.
My application is such that every field can be uniquely identified by its name. I would therefore like it to be possible for the XML file to contain the elements in any ord...
Having read Data Contract Versioning we concluded that it's not really the whole story. For example, what happens if you used to have ValueA, and in the new version it's now called ValueB and is of a different type, and you need to convert ValueA to ValueB?
There are some callbacks I could use to help with this, but it doesn't look like...
We have a some objects that are exposed by WCF services (using wsHttpBinding) and serialized into XML. Here is an extract of one of them:
[DataContract]
public class Person
{
[DataMember] private string _forename;
[DataMember] private string _middleInitial;
[DataMember] private string _surname;
[DataMember] private List...
Hi,
I have application created using WCF and C#, it's architecture requires to add KnownTypes through App.config. I have services going like this:
Client -> CentralServer -> DataServer (where -> is WCF connection)
Now, I've added KnownTypes to both CentralServer App.config and DataServer App.config this way:
<add
type="Odra.Server.Ce...
I have the following serialized XML:
DataDescriptor
<d5p1:TimePastToInitializeData >
<d5p1:Hours>2</d5p1:Hours>
<d5p1:Minutes>10</d5p1:Minutes>
<d5p1:Seconds>5</d5p1:Seconds>
</d5p1:TimePastToInitializeData>
<d5p1:PollRate >
<d5p1:Hours>2</d5p1:Hours>
<d5p1:Mi...
My SomeClass
[Serializable]
[DataContract(Namespace = "")]
public class SomeClass
{
[DataMember]
public string FirstName
{
get; set;
}
[DataMember]
public string LastName
{
get; set;
}
[DataMember]
private IDictionary<long, string> customValues;
public IDictionary<long, str...
I have some XML that I am trying to transform to HTML using XSLT, but I can't get it to work for the life of me. Can someone tell me what I am doing wrong?
XML
<ArrayOfBrokerage xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.test.com/">
<Brokerage>
<BrokerageID>91</BrokerageID>
<LastYodleeUpdate>0001-01-01T0...
I have a fairly complex object model that I'm trying to serialize using WCF. I'm running into a problem where I can create a new instance on the server and return it to the client, then trying to pass that same object back or even serialize it using the DataContractSerializer throws an exception.
Test method Server.Service.Test.Seriali...
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 that's a class with the namespace "http://core.test.com". When I serialize this to XML I get the following:
<ArrayOfSecurityHolding xmlns:i="htt...
Dear ladies and sirs.
Observe the following sample code:
namespace A
{
[Serializable]
internal class ComplexObject<T> : List<T>, IEquatable<ComplexObject<T>>
where T : IEquatable<T>
{
private T m_state;
internal T State
{
get { return m_state; }
set { m_state = value; }
}
public bool Equals(C...
Hi,
Is there a chance to get a data contract serializer used by operation (DataContractSerializer/NetDataContractSerializer/XmlSerializer etc) in runtime (for instance using operation behaviour). What I want to achieve is to create some diagnostic code that would serialize messages (in message inspector) using currently attached seriali...
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 - using .Net 4 beta 2
The object will never need to be deserialized.
XML should not have any xmlns:... namespace refs
Any subtypes of Exception an...
I am writing a Sivlerlight Chat application using Sockets and the DataContractSerializer.
I have a class hierarchy of serializable objects with the definitions shared between the Silverlight Client and the C# Server.
When a buddy logs on they send a message to the server and if they are verified they are sent an acknowledgment follow...