The Artima Developer Community
Sponsored Link

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

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Christian Weyer

Posts: 616
Nickname: cweyer
Registered: Sep, 2003

Christian Weyer is an independent Microsoft MSDN Regional Director and expert for Web services.
Today and tomorrow: Will Indigo heal...? I want, I want - no, I want my DataSet! Posted: Mar 19, 2005 9:52 AM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Christian Weyer.
Original Post: Today and tomorrow: Will Indigo heal...? I want, I want - no, I want my DataSet!
Feed Title: Christian Weyer: Web Services & .NET
Feed URL: http://www.asp.net/err404.htm?aspxerrorpath=/cweyer/Rss.aspx
Feed Description: Philosophizing about and criticizing the brave new world ...
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Christian Weyer
Latest Posts From Christian Weyer: Web Services & .NET

Advertisement

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: Today and tomorrow: Will Indigo heal...? I want, I want - no, I want my DataSet!

Topic: Installed SQL Server 2005? Previous Topic   Next Topic Topic: Discussions at the Pub Summit with Scoble, Gary Cornell, and Brad Wilkens

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use