Local code and server code

Local code and server code

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


RichardETVS posted on Wednesday, January 23, 2008

Hi

 

In an application with local clients and a IIS hosted server application, am I right to think that by default, all the routines are local for the client, except the SAVE (the update) and the Get (the fetch) ? Or must I manually use something to tell which routine are local and which are server side?

 

Thanks for your help!

 

 

Marjon1 replied on Wednesday, January 23, 2008

The way that it works with CSLA is that any code within a DataPortal_XYZ method will be executed on the server by default; however, you can attribute the method to enforce that it will always run on the client.The attribute is [RunLocal].

This is where the use of CommandObjects with the DataPortal_Execute method allow you to run code on the server outside of the normal create,fetch,insert,update and delete methods.

Marjon

RichardETVS replied on Wednesday, January 23, 2008

Marjon:
The way that it works with CSLA is that any code within a DataPortal_XYZ method will be executed on the server by default
Thanks for your answer, Marjon.

So, if I understand correctly, if I have a CSLA object who has a method Traitment, this method will be local as it is not a DataPortal_XYZ method?

 

tmg4340 replied on Wednesday, January 23, 2008

Well... that depends.  Smile [:)]

The DP_ routines are, as has already been noted, executed on the server side, unless the "RunLocal" attribute is applied.  Any routines that are called from the DP_ method code would also be executed server-side as well.  So if your "Traitment" method is called from one of your DP_ methods, then it will run on the server.  Otherwise, it's running in your client process.

(Note that if you're running the local DataPortal, everything is technically client side, since you have no external server in that instance.  But that's probably not what you're asking.)

HTH

- Scott

RichardETVS replied on Wednesday, January 23, 2008

Ok, thanks, Scott, that's clear :) .

Copyright (c) Marimer LLC