Print Page | Close Window

Invoking Server Side Methods

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1980
Printed Date: 04-May-2025 at 5:43am


Topic: Invoking Server Side Methods
Posted By: BillG
Subject: Invoking Server Side Methods
Date Posted: 20-Jul-2010 at 6:52am
I understand that classes like CustomerViewModel sit on the client side and are invoked for things like retrieving customers to display in a grid or a single customer to display in a form.
 
When I save a customer record, I would like to recalculate his balance just to ensure that it is up to date. To do this I will loop through the customers charges and payments and get a balance. I don't want to bring any records down to the client to do this, I would like to do this on the server. So I am thinking that I will have a CalculateBalance method on the server side that will do the above and update the balance in the customer table in the database.
 
How will this method get invoked?
 
I am assuming my view class will call a routine in the ViewModel and then the ViewModel will pass the call to the server.
 
Bill
 



Replies:
Posted By: davidklitzke
Date Posted: 20-Jul-2010 at 2:14pm
You will need to use the InvokeServerMethod method of the EntityManager.  There is a synchronous and asynchronous version of this method.


Posted By: ting
Date Posted: 20-Jul-2010 at 7:57pm

Take a look at the EntityServerSaveInterceptor.  You can examine the objects that are being saved there and add any other records to the transaction.




Print Page | Close Window