Tuesday, February 14, 2012

Best way to inform .NET app of change in DB content

Previously had a 'prototype' (.NET 1.0, SQL Server 2000, CCW to .NET) whereby an update trigger called out to our .NET app. Obvioulsy now SQL Server 2005 is nearly upon us I'd like to explore a better mechanism in order to consider the next phase of deployment (.NET 2, SQL Server 2005).

I have a number of servers that 'cache' data from a table in SQL Server. At some later time one of the servers may update a set of the data. When this occurs I'd like to alert the other servers that the data has changed so they can refresh/drop it from the local cache/ The data can cover a number of rows from one of the DB tables (depends on how the cache is configured). The table is simply a persistent object store.

With .NET being an integral part of SQL2005, does anyone have any guidance on how to achieve this efficiently. I'd like to think there would be a .NET event mechanism built in, but I've not seen anything like this!

Thanks in advance!You can use SQL Server Notification Services: http://www.devx.com/dbzone/Article/28522|||

You can use the SqlNotification class in .NET 2.0 - this can be used in both SQL Server 2000 and SQL Server 2005

|||

Thank you both for your answers! I had look at SQL Notification Services but wondered if this is too 'heavyweight' for my needs. I'll take a close look at the .NET 2 feature.

|||You can test it out by visiting http://msdn.demoservers.com and look for the SQL Server 2005 and ADO.NET hands-on lab as this covers using the SqlNotification and SqlDependency objects in .NET 2.0|||Look up topics on Query Notifications and SqlDependency in the 2005 MSDN Library. Note that these are not the same as Notification Services. They're much lighter-weight, and focused on firing application events rather than sending external notifications. -- Adam MachanicSQL Server MVPhttp://www.datamanipulation.net-- <adamhearn@.discussions..microsoft.com> wrote in message news:68627a2a-01ab-42f4-b950-54dd2e1a3041@.discussions.microsoft.com...Previously had a 'prototype' (.NET 1.0, SQL Server 2000, CCW to .NET) whereby an update trigger called out to our .NET app. Obvioulsy now SQL Server 2005 is nearly upon us I'd like to explore a better mechanism in order to consider the next phase of deployment (.NET 2, SQL Server 2005).I have a number of servers that 'cache' data from a table in SQL Server. At some later time one of the servers may update a set of the data. When this occurs I'd like to alert the other servers that the data has changed so they can refresh/drop it from the local cache/ The data can cover a number of rows from one of the DB tables (depends on how the cache is configured). The table is simply a persistent object store.With .NET being an integral part of SQL2005, does anyone have any guidance on how to achieve this efficiently. I'd like to think there would be a .NET event mechanism built in, but I've not seen anything like this!Thanks in advance!

No comments:

Post a Comment