Good C#.NET Solution to manage frequent database polling

I think you might want to go with a combination of two approaches. First off, you could use long polling from the client to server so that the server can notify the client as soon as a change occurs that the client is interested in.

A new technology that handles the above suggestion quite nicely in ASP.NET is SignalR. This handles much of the details of long polling (or uses WebSockets when it can) so you don't have to worry about it.

Secondly, based on the tags in this question it looks like you're using SQL Server. You could use database notifications on the tables you are interested in to have the DB notify your service when changes occur. This could then trigger the service to notify the client about the changes through the long poll connections. You can do this using the SqlDependency class.

I'm sure there are other ways, but this would probably scale quite well as you'd only have one service getting the notifications and then distributing them out to all the clients.


you can define a callback interface in the WCF connection like this:

[ServiceContract(CallbackContract = typeof(IFooClient))]

As the client initiates the connection the should work through the firewall. The the server can method to register for changes an you can get the callback interface with

IFooClient client = OperationContext.Current.GetCallbackChannel<IFooClient>();

and callback all the clients that are registered on data changes.