public override void ReaderExecuting(System.Data.Common.DbCommand command, System.Data.Entity.Infrastructure.Interception.DbCommandInterceptionContext <System.Data.Common.DbDataReader> interceptionContext) { if (AddNoLockHintToSqlQueries) { command.CommandText = TableAliasRegex.Replace(command.CommandText, "${tableAlias} WITH (NOLOCK)"); } }
void System.Data.Entity.Infrastructure.Interception.IDbCommandInterceptor.ScalarExecuting(System.Data.Common.DbCommand command, System.Data.Entity.Infrastructure.Interception.DbCommandInterceptionContext <object> interceptionContext) { }
void System.Data.Entity.Infrastructure.Interception.IDbCommandInterceptor.ReaderExecuting(System.Data.Common.DbCommand command, System.Data.Entity.Infrastructure.Interception.DbCommandInterceptionContext <System.Data.Common.DbDataReader> interceptionContext) { try { //If this is a tenant table then rig query plan for this specific tenant if (command.CommandText.Contains("__vw_tenant") || command.CommandText.Contains("__security")) { var builder = new SqlConnectionStringBuilder(command.Connection.ConnectionString); command.CommandText = "--T:" + builder.UserID + "\r\n" + command.CommandText; } if (GeoLocationEntities.QueryLogger != null) { var debugInfo = ((IGeoLocationEntities)(interceptionContext.DbContexts.First())).ContextStartup.DebugInfo; GeoLocationEntities.QueryLogger(debugInfo + "\r\n" + command.CommandText); } } catch { } }
void System.Data.Entity.Infrastructure.Interception.IDbCommandInterceptor.ReaderExecuted(System.Data.Common.DbCommand command, System.Data.Entity.Infrastructure.Interception.DbCommandInterceptionContext <System.Data.Common.DbDataReader> interceptionContext) { }
void System.Data.Entity.Infrastructure.Interception.IDbCommandInterceptor.NonQueryExecuting(System.Data.Common.DbCommand command, System.Data.Entity.Infrastructure.Interception.DbCommandInterceptionContext <int> interceptionContext) { }
public override void NonQueryExecuting(DbCommand command, System.Data.Entity.Infrastructure.Interception.DbCommandInterceptionContext <int> interceptionContext) { command.CommandText = Regex.Replace(command.CommandText, string.Format(@"(?i:(?<=^UPDATE \[.+\]\.\[{0}\]\r\nSET \[{1}\] = ).+(?=\r\n))", table, column), "$& + {1}"); base.NonQueryExecuting(command, interceptionContext); }