Data Sources / Stored Procedures

  Output Cache Controller

Table of Contents
Data Sources / Stored ProceduresPrint||
Output Cache Controller

It is easy to add a data controller for the output cache table to an existing project.

Start the application generator, select the project name and choose Refresh action. Toggle the check box next to the table dbo.CustOrderHist_Cache and click Refresh button. Click Yes to confirm the refresh action.

Adding a table to a web application created with Code On Time generator

Select Design option on the project Summary Page of the application generator.

Activate Controllers tab in Project Explorer, and right-click the CustOrderHist_Cache / Business Rules node. Chose the  New Business Rule option.

Adding a declarative business rule to a data controller in a Code On Time web application

Enter the following business rule properties and click OK button.

Property Value
Command Name Select
View grid1
Type SQL
Phase Before
Script Paste the  output caching script in its entirety.

Note that the output caching script includes a section declaring parameters and their values that can be used for debugging.

The application framework will automatically remove
the script lines between Debug and End Debug.

That way you can develop a script using SQL Management Studio or any other SQL development tool compatible with your database engine. The entire script can be moved unchanged between the development tool and the Project Designer.

The application framework automatically recognizes and declares parameters and provides their values if a parameter name starts with “@BusinessRules_” or represents the name of the data controller field with optional suffixes “_NewValue”, “_OldValue”, “_Value”, “_FilterValue”, and “_FilterOperation”. All other parameters must be declared explicitly in the Script property of an SQL Business Rule or in the Data property of SQL action.

Expand the CustOrderHist_Cache / Views / grid1 view node, right-click the data field CacheUserName . Choose Delete option in context menu to remove the data field. Repeat this procedure for the field CacheExpires.

Deleteing a data field in a Code On Time web application project

Select the CustOrderHist_Cache / Views / grid1 view node and change its properties as follows. Click OK button to save the view properties.

Property New Value
Filter Expression
CacheUserName = @BusinessRules_UserName

View of the customized output cache controller 'CustOrderHist_Cache' in Project Explorer

Click Browse button on the designer tool bar to generate the project. The default web browser window will open.

Application generator has created a dedicated page for the data controller CustOrderHist_Cache when the project had been refreshed. If you have not customized any pages in the Northwind sample then the menu option to access the dedicated page is Region / Cust Order Hist Cache. Otherwise you will find it under New Pages / Cust Order Hist Cache.

Navigating to the dedicated page of the output cache table 'CustOrderHist_Cache' in the Northwind project

Navigate to the page and you will see the standard grid view of the output cache table data.

The view of the dedicated page of the output cache table 'CustOrderHist_Cache' in the Northwind project

There will be no records.