Server-side Data Portal hooks

Server-side Data Portal hooks

Old forum URL: forums.lhotka.net/forums/t/10935.aspx


Jaans posted on Wednesday, November 30, 2011

Hi All

Is there some way I could hook an event / override to the server side of the data portal to allow me to validate some information about the request?

For example I might need to get a custom session property off of the ApplicationContext.User to slide / expire the session. There are some other useful trace / audit logging options I can think of here.

Thanks,
Jaans

JonnyBee replied on Thursday, December 01, 2011

Hi Jaans,

You can hook into the DataPortal using the CslaAuthorizationProvider in Web.Config.

This will be the first call on the server for Authorizing the request (but you can do other stuff as well - f.ex logg the request).

Unfortunately, there is no similar hook for when the DataPortal has finished serving the request in the standard DataPortalProxys.

You can hook into the dataportal with custom exception handling (for transformation to serializable exception and/or exception logging) using the CslaDataPortalExceptionInspector setting. See Samples\Net\cs\CustomErrorHandling sample.

You can, however, implement your own DataPortalProxy and any custom logging/trace etc that you want.

Jaans replied on Thursday, December 01, 2011

Thanks Johnny!

I'll check out the CslaAuthorizationProvider and see if it fits my needs.

Is it a CSLA 4 only thing or is it available in CSLA 3?

Jaans replied on Thursday, December 01, 2011

FWIW - It's available in CSLA 3.8.4 also.

Copyright (c) Marimer LLC