.NET Framework Developer Center >
.NET Development Forums
>
Windows Communication Foundation
>
Partial DataContract sent over the wire
Partial DataContract sent over the wire
- Greetings,
i'm getting my hands into wcf seriously. Well i already developed some small services so i know the basics, but not we are starting to develop a new business applications we face with some problems.
One problem is sending large collections of business objects down on the wire. I'm perfectly aware the business object should be partitioned, neverthe less the problem persist.
Let's say we have to show a table with some info about customers. The number of records may vary from 1000 to 10000 in the scenario i'm working on. In a simple tier scenario, we were just crafting our sql query to include just the field we needed, optimizing response and traffic. But what can we do in wcf?
How is addressed this problem in wcf?
thank you.
Answers
- You could have a base class that would hold the data that is always sent over the wire, and a bunch of derived classes that expand your base class (holding additional data). How does this sound to you?Regards,Stipe Ivan
- Marked As Answer byRiquel_DongModeratorFriday, November 13, 2009 2:35 AM
All Replies
- Hi,
From my understanding,it seems that you are looking out for optmizing your wcf request and response. There are lot of factors that can be considered.
1.)By default the data is always buffered before being sent. Therefore you can consider streaming the data in your case. But streaming has its own limitations. Please refer to the below lnk
http://msdn.microsoft.com/en-us/library/ms731913.aspx
2.)Else you can opt for chunking channel where the data is buffered but not entirely. Only chunks of the data is buffered adn thereby allowing you retain the advantages of buffering like Reliable messaging,security etc which would otherwise not be available in streaming mode.
3.)You can choose a binary message encoder which would enable a relatively faster way to communicate. But then this would not be interoperable
http://msdn.microsoft.com/en-us/library/aa751889.aspx
But to transfer large data and maintain interoperability, you can go in for message streaming. But be sure to check out the above link on what all features wouldnt be available when you choose streaming.
Please mark the response as answers if it solves your question or vote as helpful if you find it helpful. http://thoughtorientedarchitecture.blogspot.com/ - Hello,
thank you for your response, but no, i'm not looking for optimizing as outlined on those links.
Let's make an example.
I've the following data contract
public class Person
{
[DataMember]
public String Id { get; set; }
[DataMember]
public String Name { get; set; }
[DataMember]
public String Address { get; set} ;
[DataMember]
public String Location{ get; set} ;
[DataMember]
public String Phone{ get; set} ;
[DataMember]
public String Fax{ get; set} ;
}
On client side, i need to show a grid with just name, and location: all other datamembers are not required, so there's no point sending all that stuff over the wire. With large collections this would save lot of traffic.
thank you again- Edited byCristian Prevedello Saturday, November 07, 2009 7:46 PM
- You could have a base class that would hold the data that is always sent over the wire, and a bunch of derived classes that expand your base class (holding additional data). How does this sound to you?Regards,Stipe Ivan
- Marked As Answer byRiquel_DongModeratorFriday, November 13, 2009 2:35 AM
Well, we brainstormed more at the root of the problem, and started from the beginning, where we get our data from: our model:
1) split entities and request additional info sperataly, somithing similar to Stipe-Ivan Latkovic proposed, thought more flexible
2) consider for datagrid view only (without business logic) something similar to a dataset to achieve max performances. We are still defining specs for this approach.


