Tony The Lion
Tony The Lion

Reputation: 63190

WCF service for handling SQL queries - advice please

Following on from this question, would it be a wise idea to place a WCF service at the server side, between client and database to handle queries?

The idea being that you take load of the network and reduce round trips to and from a database.

I would use the Entity Framework to query the database in the service, and just send results to requesting apps over the network.

I wondered if this is a silly or good idea?

There would be up to 10 clients and 1 server. Lots of queries requesting a few 1000 records at times, requiring quite a bit of calculations applied to them at times.

Upvotes: 0

Views: 593

Answers (2)

marc_s
marc_s

Reputation: 754268

Well, seems like a really smart idea at first.

But what are you going to return then?? A WCF contract needs to be very specific about its return values - you need to tell it whether it'll be a list of customers, or a single order with its order details etc.

Trying to get this to work generally, for any kind of SQL or EF / Entity-SQL query you want to have executed, might just be too tricky. You would almost have to "dumb it down" to a List<object> or List<BaseBusinessClass> something for it to work in a very generic way.

Upvotes: 1

Ot&#225;vio D&#233;cio
Ot&#225;vio D&#233;cio

Reputation: 74250

I think it wouldn't be as efficient simply because of the protocols, wcf will require a lot more bytes to sand things back and forth than the native sql server protocol.

Upvotes: 2

Related Questions