New Posts New Posts RSS Feed: MVVM and who should invoke RemoteServerMethod?
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

MVVM and who should invoke RemoteServerMethod?

 Post Reply Post Reply
Author
BillG View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 05-Dec-2007
Location: Monroe, MI
Posts: 233
Post Options Post Options   Quote BillG Quote  Post ReplyReply Direct Link To This Post Topic: MVVM and who should invoke RemoteServerMethod?
    Posted: 07-Feb-2011 at 10:27am
I am trying to figure out which class should invoke the RemoteServerMethod? I first thought of the ViewModel but the InvokeServerMethodAsync is called using the EntityManager. My ViewModel doesn't have any knowledge to the entitymanager as my viewmodel calls the repository who calls the various CRUD methods. So I am thinking that the ViewModel should call the Repository and pass over the methodname and typename and let the repository call the invokeServerMethodAsync unless there is another approach or I am missing something. On the other hand this is not really a method for the repository because inside the remoteservermethod I make CRUD calls but since the repository class is the only class that knows of the entitymanager I can't think of any better way to do it.

Bill
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 08-Feb-2011 at 6:41pm
Hi BillG;

I hope what you mean by Repository is the Data Services layer that actually interacts with the EM. If so, then looking at Ward's BookShelfDF example, what you're describing is the correct way to do it. In the BookShelfDF, the ViewModel interacts with the Services layer that does the actual interaction with the EM and the Services layer does the actual calling of the InvokeServerMethodAsync.

I suggest that you look at these resources that I'm sure will answer your questions better.


Hope this helps.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down