LightSwitch with Oracle Data Source (part 3) – Server Side Data filtering

Long time ago I started those posts and now it’s time for me to write the next part.

But first I need to describe some changes based on version evolution of LightSwitch.

With the newest version we can filter table data on server side using session variables.

It all starts from “SessionCheck.aspx” (this is a file we added in part 2 for developing LightSwitch applications with external authentication)

p2 AddSessionService

The code shall look like this:



The new here is adding System.Web.SessionState.IRequiresSessionState allowing us to access Session object and storing values in it.

In logical view access any table you want to Data Filter and click on Write Code \ *_flter to enter filtering event code.


The code you see will look like this:

What we need to add for server side filtering in my case shall make the code to look like this:

One more thing we need to do: All record shown in the application are now filtered and it will be nice in case of change or insert to be sure filtered values are not changed.

For this the be secured we need to add Insert handler, Delete handler and Update handler:

It’s a lot to code for each entity object in your database, but it’s stable and secure way to filter input and output from your tables.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.