.NET Framework Bookmark and Share   
 index > Windows Communication Foundation > WCF services and ADO.NET datasets
 

WCF services and ADO.NET datasets

I've been working for a long time on a major WCF service. This service is meant to transfer a lot of data over our network. Since it is an internal app, I am not concerned about Interoperability. Also, because of the huge number of fields being transferred through the methods ofthis WCF service, I did not want to write data contracts, as the odds of my messing up at leastone of the 1000+ fields being transferredvia this WCF service is highly likely. Therefore, it was muchquicker for me to use datasets, and let VS 2008 generate the necessary SQL and methods. I know that is not best practice, but it is expediant.

However, in our local .NET user group meeting recently we had a discussion on WCF over TCP, which is exactly what I'm working on doing. (I've actually finished doing the coding and am now testing it.) At the meeting it was discussed that ADO.NET datasets do not actually drop their connections. That if you use them in WCF services, and use them heavily, that over time the system resources on the Windows server they're running from will be consumed with these open connections. (Or at least connections which haven't yet closed.) I want to verify: is this an issue with ADO.NET datasets, if they're used a heavily in a WCF service?

Rod
Rod at Work
A dataset never has a connection to a database - it is a disconnected structure. You populate a dataset using a DataAdapter or DataReader which do have a connection to the database but these are not part of a dataset's serialization
Richard Blewett, thinktecture - http://www.dotnetconsult.co.uk/weblog2
Twitter: richardblewett
Richard Blewett
Hi Rod,

Please refer to XML and ADO.NET Types in Data Contracts.
http://msdn.microsoft.com/en-us/library/aa347876.aspx
The Windows Communication Foundation (WCF) data contract model supports certain types that represent XML directly. When these types are serialized to XML, the serializer writes out the XML contents of these types without any further processing. Supported types are XmlElement , arrays of XmlNode (but not the XmlNode type itself), as well as types that implement IXmlSerializable . The DataSet and DataTable type, as well as typed datasets, are commonly used in database programming. These types implement the IXmlSerializable interface and are therefore serializable in the data contract model. Some special considerations for these types are listed at the end of this topic.

•Legacy DataSet types are IXmlSerializable types that are not marked with the XmlSchemaProviderAttribute attribute. Instead, they rely on the GetSchema method for schema generation. This pattern is used for the DataSet type and its typed dataset derives a class in earlier versions of the .NET Framework, but is now obsolete and is supported only for legacy reasons. Do not rely on this pattern and always apply the XmlSchemaProviderAttribute to your IXmlSerializable types.

Also have a look at ADO.NET Architecture for your reference:
http://msdn.microsoft.com/en-us/library/27y4ybxw(VS.80).aspx

Best regards,
Riquel
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Riquel_Dong
Hi Rod,

There aren't any open connections issues known generally with DataSetsbecause of usingWCF. I would recommend that use perfmon.exe with .NET Data Provider for SQL Server counters & monitor connections. You can post your findings and we can take it from there.

Niraj
[http://nirajrules.wordpress.com]
Niraj Rules
A dataset never has a connection to a database - it is a disconnected structure. You populate a dataset using a DataAdapter or DataReader which do have a connection to the database but these are not part of a dataset's serialization
Richard Blewett, thinktecture - http://www.dotnetconsult.co.uk/weblog2
Twitter: richardblewett
Richard Blewett
Well, I guess I'm going to have to ask the two who gave the presentation, what they were referring to. Thank you, Niraj and Richard.

Rod
Rod at Work
Hi Rod,

Please refer to XML and ADO.NET Types in Data Contracts.
http://msdn.microsoft.com/en-us/library/aa347876.aspx
The Windows Communication Foundation (WCF) data contract model supports certain types that represent XML directly. When these types are serialized to XML, the serializer writes out the XML contents of these types without any further processing. Supported types are XmlElement , arrays of XmlNode (but not the XmlNode type itself), as well as types that implement IXmlSerializable . The DataSet and DataTable type, as well as typed datasets, are commonly used in database programming. These types implement the IXmlSerializable interface and are therefore serializable in the data contract model. Some special considerations for these types are listed at the end of this topic.

•Legacy DataSet types are IXmlSerializable types that are not marked with the XmlSchemaProviderAttribute attribute. Instead, they rely on the GetSchema method for schema generation. This pattern is used for the DataSet type and its typed dataset derives a class in earlier versions of the .NET Framework, but is now obsolete and is supported only for legacy reasons. Do not rely on this pattern and always apply the XmlSchemaProviderAttribute to your IXmlSerializable types.

Also have a look at ADO.NET Architecture for your reference:
http://msdn.microsoft.com/en-us/library/27y4ybxw(VS.80).aspx

Best regards,
Riquel
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Riquel_Dong
Thank you, Riquel.

Rod
Rod at Work

You can use google to search for other answers

Custom Search

More Threads

• How to add HttpHeaders in WCF Client?
• Problem in generating proxy
• namespace does not allow impersonation in wcf
• WCF service member function not called
• Streaming on Callback
• WCF ServiceHost creation problem
• wcf service being blocked
• ASP.NET Consuming net tcp wcf service
• How Async pattern works in WCF AsyncProxy side?
• The certificate 'CN=localhost' must have a private key that is capable of key exchange.The process must have access rights for