Yes you could. If you want to do it on a general level, you could intercept the calls in the DataAccessAdapter, like this:
public class CommandInterceptorDataAccessAdapter : DataAccessAdapter
{
/// <summary>CTor</summary>
public CommandInterceptorDataAccessAdapter()
{
}
/// <summary>CTor</summary>
/// <param name="keepConnectionOpen">when true, the DataAccessAdapter will not close an opened connection. Use this for multi action usage.</param>
public CommandInterceptorDataAccessAdapter(bool keepConnectionOpen) : base(keepConnectionOpen)
{
}
/// <summary>CTor</summary>
/// <param name="connectionString">The connection string to use when connecting to the database.</param>
public CommandInterceptorDataAccessAdapter(string connectionString) : base(connectionString)
{
}
/// <summary>CTor</summary>
/// <param name="connectionString">The connection string to use when connecting to the database.</param>
/// <param name="keepConnectionOpen">when true, the DataAccessAdapter will not close an opened connection. Use this for multi action usage.</param>
public CommandInterceptorDataAccessAdapter(string connectionString, bool keepConnectionOpen) : base(connectionString, keepConnectionOpen)
{
}
/// <summary>CTor.</summary>
/// <param name="connectionString">The connection string to use when connecting to the database.</param>
/// <param name="keepConnectionOpen">when true, the DataAccessAdapter will not close an opened connection. Use this for multi action usage.</param>
/// <param name="catalogNameUsageSetting"> Configures this data access adapter object how to threat catalog names in persistence information.</param>
/// <param name="catalogNameToUse"> The name to use if catalogNameUsageSetting is set to ForceName. Ignored otherwise.</param>
/// <remarks>For backwards compatibility.</remarks>
public CommandInterceptorDataAccessAdapter(string connectionString, bool keepConnectionOpen, CatalogNameUsage catalogNameUsageSetting, string catalogNameToUse) : base(connectionString, keepConnectionOpen, catalogNameUsageSetting, catalogNameToUse)
{
}
/// <summary>CTor</summary>
/// <param name="connectionString">The connection string to use when connecting to the database.</param>
/// <param name="keepConnectionOpen">when true, the DataAccessAdapter will not close an opened connection. Use this for multi action usage.</param>
/// <param name="schemaNameUsageSetting">Configures this data access adapter object how to threat schema names in persistence information.</param>
/// <param name="schemaNameToUse">Oracle specific. The name to use if schemaNameUsageSetting is set to ForceName. Ignored otherwise.</param>
public CommandInterceptorDataAccessAdapter(string connectionString, bool keepConnectionOpen, SchemaNameUsage schemaNameUsageSetting, string schemaNameToUse) : base(connectionString, keepConnectionOpen, schemaNameUsageSetting, schemaNameToUse)
{
}
/// <summary>CTor.</summary>
/// <param name="connectionString">The connection string to use when connecting to the database.</param>
/// <param name="keepConnectionOpen">when true, the DataAccessAdapter will not close an opened connection. Use this for multi action usage.</param>
/// <param name="catalogNameOverwrites"> The from-to name value pairs and setting for the overwriting of catalog names. Can be null.</param>
/// <param name="schemaNameOverwrites"> The from-to name value pairs and setting for the overwriting of schema names. Can be null.</param>
public CommandInterceptorDataAccessAdapter(string connectionString, bool keepConnectionOpen, CatalogNameOverwriteHashtable catalogNameOverwrites, SchemaNameOverwriteHashtable schemaNameOverwrites) : base(connectionString, keepConnectionOpen, catalogNameOverwrites, schemaNameOverwrites)
{
}
protected override IRetrievalQuery CreateSelectDQ(QueryParameters parameters)
{
if(this.GeneratedCommands == null)
{
this.GeneratedCommands = new List<DbCommand>();
}
var toReturn = base.CreateSelectDQ(parameters);
this.GeneratedCommands.Add(toReturn.Command);
return toReturn;
}
public List<DbCommand> GeneratedCommands { get; private set; }
/// <summary>
/// Gets the last generated command.
/// </summary>
public DbCommand LastGeneratedCommand
{
get
{
if(this.GeneratedCommands == null)
{
return null;
}
return this.GeneratedCommands.Last();
}
}
}
Modify other individual SQL parts individually is also possible but not that trivial. What is what you want to alter/modify exactly? (maybe there is another way).