A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.microsoft.com/en-us/dotnet/api/system.data.sqlclient.sqldependency below:

SqlDependency Class (System.Data.SqlClient) | Microsoft Learn

SqlDependency Class Definition

Caution

Use the Microsoft.Data.SqlClient package instead.

The SqlDependency object represents a query notification dependency between an application and an instance of SQL Server. An application can create a SqlDependency object and register to receive notifications via the OnChangeEventHandler event handler.

public ref class SqlDependency sealed
[System.Obsolete("Use the Microsoft.Data.SqlClient package instead.")]
public sealed class SqlDependency
public sealed class SqlDependency
[<System.Obsolete("Use the Microsoft.Data.SqlClient package instead.")>]
type SqlDependency = class
type SqlDependency = class
Public NotInheritable Class SqlDependency
Inheritance
Attributes

SqlDependency is ideal for caching scenarios, where your ASP.NET application or middle-tier service needs to keep certain information cached in memory. SqlDependency allows you to receive notifications when the original data in the database changes so that the cache can be refreshed.

To set up a dependency, you need to associate a SqlDependency object to one or more SqlCommand objects. To receive notifications, you need to subscribe to the OnChange event. For more information about the requirements for creating queries for notifications, see Working with Query Notifications.

For more information, see Query Notifications in SQL Server and Building Notification Solutions.

Note

The OnChange event may be generated on a different thread from the thread that initiated command execution.

Query notifications are supported only for SELECT statements that meet a list of specific requirements.

Constructors Properties HasChanges

Gets a value that indicates whether one of the result sets associated with the dependency has changed.

Id

Gets a value that uniquely identifies this instance of the SqlDependency class.

Methods Events OnChange

Occurs when a notification is received for any of the commands associated with this SqlDependency object.

See also

Collaborate with us on GitHub

The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide. In this article

Was this page helpful?


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4