BizTalk Utilities CV ,   Jobs ,   Code library
 
Go to the front page to continue learning about XML or select below:

Contents

ReBlogger Contents

Previous posts in WSCF/WCF

 
 
Page 19186 of 21350

Today and tomorrow: Will Indigo heal... I want, I want - no, I want my DataSet!

Blogger : Christian Weyer: Smells like service spirit
All posts : All posts by Christian Weyer: Smells like service spirit
Category : WSCF/WCF
Blogged date : 2005 Mar 19

Despite all the SO(A)-iness out there we sometimes just want or simply need to ignore it.
One of those topics is the good old DataSet. There is lot of trouble when you use it and you do not know all the problems and side effects it may cause. But in some certain scenarios, it might just be fine. Consider the following sample contract for an Indigo service.

[ServiceContract(Session = true)]
public interface IWantIt
{
  [OperationContract()]
  DataSet GetData(string ID);
}

A very common and often used pattern. Usually this should work just fine. ASMX does handle it quite well. But if we build an application which hosts an Indigo service that implements this contract we will get a runtime error – it builds fine, yes. Why

Indigo is using the XmlFormatter class by default. XmlFormatter does not support non-data contract schema. And using a System.Data.DataSet type means breaking with the data contract rules. However there is support for non-data contract schema using good plain old XmlSerializer.

With the following updated ServiceContracteverything should work as expected.

[ServiceContract(Session = true, FormatMode = ContractFormatMode.XmlSerializer)]
public interface IWantIt
{
  [OperationContract()]
  DataSet GetData(string ID);
}

Again, this does not mean that you are supposed to use DataSets in your contract… J



Read comments or post a reply to : Today and tomorrow: Will Indigo heal... I want, I want - no, I want my DataSet!
Page 19186 of 21350

Newest posts
 

    Email TopXML