Print Page | Close Window

MVVM and who should invoke RemoteServerMethod?

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=2490
Printed Date: 29-Mar-2025 at 7:08am


Topic: MVVM and who should invoke RemoteServerMethod?
Posted By: BillG
Subject: MVVM and who should invoke RemoteServerMethod?
Date 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



Replies:
Posted By: DenisK
Date 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.

http://drc.ideablade.com/xwiki/bin/view/Documentation/DevForce-MVVM-Patterns - http://drc.ideablade.com/xwiki/bin/view/Documentation/DevForce-MVVM-Patterns
http://drc.ideablade.com/xwiki/bin/view/Documentation/BadGolf - http://drc.ideablade.com/xwiki/bin/view/Documentation/BadGolf

Hope this helps.



Print Page | Close Window