Is it weird or strange to make multiple WCF Calls to build a ViewModel before presenting it?
Posted
by Nate Bross
on Stack Overflow
See other posts from Stack Overflow
or by Nate Bross
Published on 2010-04-02T18:56:06Z
Indexed on
2010/04/02
19:03 UTC
Read the original article
Hit count: 224
Am I doing something wrong if I need code like this in a Controller? Should I be doing something differently?
public ActionResult Details(int id)
{
var svc = new ServiceClient();
var model = new MyViewModel();
model.ObjectA = svc.GetObjectA(id);
model.ObjectB = svc.GetObjectB(id);
model.ObjectC = svc.GetObjectC(id);
return View(model);
}
The reason I ask, is because I've got Linq-To-Sql on the back end and a WCF Service which exposes functionality through a set of DTOs which are NOT the Linq-To-Sql generated classes and thus do not have the parent/child properties; but in the detail view, I would like to see some of the parent/child data.
© Stack Overflow or respective owner