• Facebook
  • Twitter
  • Youtube
  • LinedIn
  • RSS
  • Docs
  • Comparisons
  • Blogs
  • Download
  • Contact Us
Download
Show / Hide Table of Contents

Class SqlCacheDependency

Establishes a relationship between an item stored in an application's cache object and either a row in a specific SQL Server database table or the results of a SQL Server 2005 query.

Inheritance
System.Object
CacheDependency
SqlCacheDependency
Inherited Members
CacheDependency.sizeInBytes
CacheDependency.DEPENDENCY_TYPE_OVERHEAD
CacheDependency.DEPENDENCY_COUNT_OVERHEAD
CacheDependency.AddDependencies(CacheDependency[])
CacheDependency.Dependencies
CacheDependency.Dispose()
CacheDependency.DependencyDispose()
Assembly: Alachisoft.NCache.Runtime.dll
Syntax
[Serializable]
public sealed class SqlCacheDependency : CacheDependency, IDisposable, IBinaryProtocolSerializable
Remarks

You can add items with dependencies to your application's cache with the specific overloads of Add and Insert methods.

When you add an item to an application's cache object with SqlCacheDependency, on all supported versions of SQL Server (7.0, 2000, 2005), it monitors a row in a specific SQL Server database table so that when that row changes, items associated with the row will be automatically removed from the cache.
This helps you to avoid losing changes made to the object between the time it is created and the time it is inserted into the cache. SqlCacheDependency class supports the association of cached items with an SQL Server query when SQL Server 2005 is used.

Constructors

SqlCacheDependency(String, String)

Initializes a new instance of the SqlCacheDependency class, using the supplied connection string and query string.

Declaration
public SqlCacheDependency(string connectionString, string cmdText)
Parameters
Type Name Description
System.String connectionString

Connection string to be used by the dependency.

System.String cmdText

SQL statement, table name or stored procedure to execute at the data source.

Remarks

This constructor is used to create SqlCacheDependency objects that use the query-notification feature of SQL Server 2005 products.

SQL query must include the following:

SqlCacheDependency(String, String, SqlCommandType, Dictionary<String, SqlCmdParams>)

Initializes a new instance of the SqlCacheDependency class. It supports the use of 'Stored Procedures'.

Declaration
public SqlCacheDependency(string connectionString, string cmdText, SqlCommandType cmdType, Dictionary<string, SqlCmdParams> cmdParams)
Parameters
Type Name Description
System.String connectionString

Connection string to be used by the dependency.

System.String cmdText

SQL statement, table name or stored procedure to execute on the data source.

SqlCommandType cmdType

The type of the command (text/stored procedure).

System.Collections.Generic.Dictionary<System.String, SqlCmdParams> cmdParams

Parameters to be passed to the command.

Remarks

This constructor is used to create SqlCacheDependency objects that use the query-notification feature of SQL Server 2005 products.

SQL query must include the following:

  1. Fully qualified table names, including the name of the table owner. For example, to refer to a table called "customers" that is owned by the database owner, the SQL statement must refer to "dbo.customers".
  2. Explicit column names in the Select statement. You cannot use the asterisk (*) wildcard character to select all columns from a table. For example, instead of "select * from customers", you must use "select name, address, city, state from dbo.customers".

Properties

CommandParams

Parameters to be used by the dependency.

Declaration
public Dictionary<string, SqlCmdParams> CommandParams { get; set; }
Property Value
Type Description
System.Collections.Generic.Dictionary<System.String, SqlCmdParams>

Dictionary with string type of keys and SqlCommand type values holding the information about the type and value of the parameters passed to the command.

CommandText

SQL statement, table name or stored procedure to be executed on the data source.

Declaration
public string CommandText { get; set; }
Property Value
Type Description
System.String

Command Text.

CommandType

Describes the type of the SQL command passed to the SQLDependency.

Declaration
public CommandType CommandType { get; set; }
Property Value
Type Description
System.Data.CommandType

Type of SQL command.

ConnectionString

The connection string that is required to the cache in order to connect with database.

Declaration
public string ConnectionString { get; set; }
Property Value
Type Description
System.String

Connection String.

Contact Us

PHONE

+1 (214) 764-6933   (US)

+44 20 7993 8327   (UK)

 
EMAIL

sales@alachisoft.com

support@alachisoft.com

NCache
  • NCache Enterprise
  • NCache Community
  • Edition Comparison
  • NCache Architecture
  • Benchmarks
Download
Pricing
Try Playground

Deployments
  • Cloud (SaaS & Software)
  • On-Premises
  • Kubernetes
  • Docker
Technical Use Cases
  • ASP.NET Sessions
  • ASP.NET Core Sessions
  • Pub/Sub Messaging
  • Real-Time ASP.NET SignalR
  • Internet of Things (IoT)
  • NoSQL Database
  • Stream Processing
  • Microservices
Resources
  • Magazine Articles
  • Third-Party Articles
  • Articles
  • Videos
  • Whitepapers
  • Shows
  • Talks
  • Blogs
  • Docs
Customer Case Studies
  • Testimonials
  • Customers
Support
  • Schedule a Demo
  • Forum (Google Groups)
  • Tips
Company
  • Leadership
  • Partners
  • News
  • Events
  • Careers
Contact Us

  • EnglishChinese (Simplified)FrenchGermanItalianJapaneseKoreanPortugueseSpanish

  • Contact Us
  •  
  • Sitemap
  •  
  • Terms of Use
  •  
  • Privacy Policy
© Copyright Alachisoft 2002 - . All rights reserved. NCache is a registered trademark of Diyatech Corp.
Back to top