Click here to Skip to main content
15,891,903 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I have created a wcf service for doing all the DB calls and to get the result set.
I am using MemoryStream to retrieve the data from wcf service and write the stream into a file.then converting the filestream to dataset for getting result.

Doing this is taking so much time than the normal execution time.

How can i optimize this.

Suggestions needed

Thanks
Ajit Kumar Nayak
Posted
Comments
Sergey Alexandrovich Kryukov 18-Jun-13 8:11am    
Why do you use such a complicated scenario? We won't be able to help without knowing some important detail, starting from your goals.
—SA
Keith Barrow 18-Jun-13 8:59am    
This *seems* needlessly complicated on first look. Can you update your question (Click the green "Improve question" link)? Please let us know what you want to achieve (rather than what you are doing) and anything oddities and such that might make the problem more complicated.
Ajit Kumar Nayak 27-Jun-13 6:45am    
Hi Keith,

I understood what u said, I am explaining

I have developed a wcf service with 2 methods to fetch data from DB by executing a sql query

e.g . getData1(sql),getData2(sql).

Which returntype is MemoryStream.
When I add reference in my client application .
and pass query to the method getData1(sql)

Then returning MemoryStream is taking long time.

I have simple executed the query in the database and it is taking less time than the service is taking.

Why this so ?

Need some good solution from ur end

Thanks

1 solution

why don't you simply create datacontracts on WCF side to send the data instead of using stream and file operations? Also instead of datasets if you could consume those data contracts directly to bind to some datagrid or some listview etc that should work as per my understanding....
eg.
C#
[ DataContract]
public class class Employee
{
      [DataMember]
      Name{get;set;}
       
       [DataMember]
       ID{get;set;} 
}

[CollectionDataContract]
public class Employess:List<employee>
{
}

//WCF web service API
public Employees GetAllEmployees();
</employee>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900