public SQLStatementInfo(SQLStatementInfo sqlStatementInfo) { if (sqlStatementInfo == null) { throw new ArgumentException("sqlStatementInfo"); } if (string.IsNullOrEmpty(sqlStatementInfo.Text)) { throw new ArgumentException("sqlStatementInfo.Text"); } if (string.IsNullOrEmpty(sqlStatementInfo.TableName)) { throw new ArgumentException("sqlStatementInfo.TableName"); } if (sqlStatementInfo.Key == Guid.Empty) { throw new ArgumentException("sqlStatementInfo.Key"); } if (sqlStatementInfo.ColumnNames == null) { throw new ArgumentException("sqlStatementInfo.ColumnNames"); } _Text = sqlStatementInfo.Text; _TableName = sqlStatementInfo.TableName; _Key = sqlStatementInfo.Key; _ColumnNames = sqlStatementInfo.ColumnNames; }
private SqlDependency SeekNotification(SQLStatementInfo sqlInfo, SqlCommand cmd) { // create dependency associated with cmd SqlDependency depend = new SqlDependency(cmd, null, 0); // register handler depend.OnChange += (delegate(object caller, SqlNotificationEventArgs e) { if (DataChanged != null) { DataChanged(caller, e, sqlInfo); } if (AutoRenewRequest) { SeekNotification(sqlInfo, new SqlCommand(cmd.CommandText, cmd.Connection)); } } ); if (cmd.Connection.State != System.Data.ConnectionState.Open) { cmd.Connection.Open(); } SqlDataReader dr = cmd.ExecuteReader(); dr.Close(); return(depend); }
public WatchedStatementInfo(SQLStatementInfo statementInfo, SqlCommand command) : base(statementInfo) { if (command == null) { throw new ArgumentNullException("command"); } _Command = command; }
public virtual void SQLChangeNotifier_DataChanged(object caller, SqlNotificationEventArgs e, SQLStatementInfo sqlStatmentInfo) { lock (_DataChangedEventSyncLock) { List <string> dependents = _DependencyMap.GetDependentTypes(sqlStatmentInfo.TableName); _Cache.ExpireTypes(dependents); } }