Welcome to MSDN Blogs Sign in | Join | Help

Browse by Tags

All Tags » Serialization   (RSS)

Interfaces Lack Data

Why does having two known types blow up for being conflicting data contract types if the types are two different interfaces? An interface only contains declarations for its members. The interface doesn't contain any data fields and any implementation

Building a Data Contract Serializer Behavior

In configuration there's a DataContractSerializer behavior that I can add to my service, but the class it uses is internal. How do I get the same behavior programmatically? The DataContractSerializer behavior is a shortcut for setting the MaxItemsInObjectGraph

Finding CLR Types from Schema

How can I found out what CLR type a particular XML schema definition will map to when using data contracts? Ask the type system what type it thinks the schema will map to. static string ClrTypeForXmlType(XmlQualifiedName xmlType) { return new XsdDataContractImporter().GetCodeTypeReference(xmlType).BaseType;

Order Best Practices

Why is setting the Order property on data members recommended when adding fields in a new version of the contract? The data contract versioning best practices recommend taking three steps when adding fields in a new version of a contract. The first recommendation

Serialization Methods for Collections

What methods do I need to implement to have data serialized and deserialized for a collection? Serialization considers there to be three primary types of collections: dictionary-based collections, list-based collections, and plain old collections (everything

Collection Name Generation

Last time we were looking at how to replace the default names used for serializing collections , such as ArrayOfKeyValueOfstringArrayOfstringty7Ep6D1, with more intelligible names. However, where did that funny looking name come from in the first place?

Naming Collection Items

How do I replace the names of entries in a collection? By default the names inside of a collection are based on the type or role of the entry. < CheeseMap > < KeyValueOfstringCheeseListLjh4bohd > < Key > Sweden </ Key > < Value

Types of Collections

If a type implements multiple kinds of collections, which pattern for collection types will be used when the object is serialized? The order that is checked for supporting collection interfaces is: IDictionary<TKey, TValue> IDictionary IList<T>

Putting Data in Order

How do I control the order in which members of the data contract are serialized? The DataMember attribute has a property called Order that influences the order in which the different members are serialized. Let's call the value of the Order property the

Orcas SP1 Update

An update to Orcas SP1 is being rolled out that will be available through Windows Update. The update contains application compatibility fixes for the .NET Framework following the Orcas SP1 release. If for some reason you need to install it directly, the

Fault Serialization with XmlSerializer

About 20 posts ago, back before PDC, this was the next topic in the queue to be posted. It has been somewhat delayed by all of the talk of product announcements and details about future releases. Since it was becoming lonely and forgotten I thought I'd

Working with XElement Names

XElement has a slightly different way of talking about XML than what WCF uses. This can lead to subtle bugs if you're not careful. Everywhere you see XML used in WCF, it is processed using an XmlReader and XmlWriter. These classes allow you to work with

No Choice for Data Contracts

I have a schema file that describes a choice between multiple layout formats for a type. How do I build a proxy that matches this schema? The reason that this is probably not working is because DataContractSerializer for the most part does not support

Getting Better Time Formats

Orcas introduced a new DateTimeOffset class that is easier to use for representing absolute times than the original DateTime class. However, if you run svcutil on a contract that contains a DateTimeOffset, you'll get an ugly generated structure because

Avoiding Infinite Schema Chains

I was working on some services with recursive data structures when I noticed that there were a few cases where I would get crashes while trying to generate proxy classes. The problems seemed to be around types that were a sequence of instances of themselves.
More Posts Next page »
 
Page view tracker