Search code examples
c#sqldatasettableadapter

Intercept and change SQL on TableAdapter


We have a Dataset with about 40 TableAdapters on it. These are used everywhere in several hundred differnt projects.

To add a layer of security I now have the requirement to add some paramaters to all the queries on all the TableAdapters in the Dataset.

Is there a way I can intercept all queries and add the paramater so I do not need to update all the code using the table adapters?


Solution

  • It is doubtful that you will be able to do this. You might be able to use some the Policy Injection Block to assist but it is a stretch. Here is the overview from MSDN.

    ... application block can be used to implement interception policies to streamline the implementation of common features, such as logging, caching, exception handling, and validation, across a system.