Best Practice for csla Lookup list in Asp.net MVC

Best Practice for csla Lookup list in Asp.net MVC

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


RandyH posted on Friday, August 06, 2010

Based on the ProjectTracker samples it appears as though the best practice when using csla is to pass the business object to the view via its Model. That works great.

My question is if the business object has field(s) that are selected from some list (a read only root list) what is the best practice for getting the list to the view? As far as I know there are 3 basic approaches:

  1. From within the controller place the list in ViewData
  2. Create html helpers that will return the list to the view
  3. Create a view model that has the business object as one of its properties and create properties for and lookup list on the view model.

Any thoughts would be greatly appreciated.

 

xAvailx replied on Friday, August 06, 2010

I generally create a view model class that has properties for the other classes needed in the view. That way you get strong typing.

Copyright (c) Marimer LLC